package com.agent.management.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 知识库子系统配置项（app.kb.*）
 */
@Data
@Component
@ConfigurationProperties(prefix = "app.kb")
public class KbProperties {

    /**
     * 总开关：false 时所有 kb 接口返回 503（运维应急降级用）
     */
    private boolean enabled = true;

    /**
     * 文档上传根目录
     */
    private String uploadDir = "./uploads/kb";

    /**
     * 单文件最大字节数（默认 50MB）
     */
    private long maxFileSize = 52428800L;

    /**
     * 文档分块大小（字符数）
     */
    private int chunkSize = 1000;

    /**
     * 分块重叠（字符数）
     */
    private int chunkOverlap = 200;

    /**
     * 允许上传的 MIME 类型白名单
     */
    private List<String> allowedMimeTypes = new ArrayList<>(List.of(
            "application/pdf",
            "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
            "application/msword",
            "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
            "application/vnd.ms-excel",
            "application/vnd.openxmlformats-officedocument.presentationml.presentation",
            "application/vnd.ms-powerpoint",
            "text/plain",
            "text/markdown",
            "text/html"
    ));
}
