package com.cy.guoyan.admin.module.ai.controller.admin.chatdocument.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import javax.validation.constraints.*;
import java.time.LocalDateTime;

@Schema(description = "管理后台 - 知识库文档新增/修改 Request VO")
@Data
public class ChatDocumentSaveReqVO {

    @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28328")
    private Long id;

    @Schema(description = "源文档 ID（更新时使用）", example = "13509")
    private String difyDocumentId;

    @Schema(description = "源文档 ID（更新时使用）", example = "13509")
    private String ragflowDocumentId;

    @Schema(description = "知识库 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26727")
    @NotNull(message = "知识库 ID不能为空")
    private String datasetId;

    @Schema(description = "批次号")
    private String batch;

    @Schema(description = "数据来源类型（file_upload/api 等）", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotEmpty(message = "数据来源类型（file_upload/api 等）不能为空")
    private String dataSourceType;

    @Schema(description = "来源信息（JSON）")
    private String dataSourceInfo;

    @Schema(description = "处理规则 ", example = "23828")
    private String processRuleMode;

    @Schema(description = "文档名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "木易")
    @NotEmpty(message = "文档名称不能为空")
    private String name;

    @Schema(description = "文件大小")
    private String fileSize;


    @Schema(description = "文件配置")
    private Long fileConfId;


    @Schema(description = "文件路径")
    private String filePath;

    @Schema(description = "创建来源（upload/api）", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "创建来源（upload/api）不能为空")
    private String createdFrom;

    @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "创建者不能为空")
    private String createdBy;

    @Schema(description = "创建时间（业务）", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "创建时间（业务）不能为空")
    private LocalDateTime createdAt;

    @Schema(description = "总 Token 数", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "总 Token 数不能为空")
    private Integer tokens;

    @Schema(description = "文档字数", requiredMode = Schema.RequiredMode.REQUIRED, example = "25319")
    @NotNull(message = "文档字数不能为空")
    private Integer wordCount;

    @Schema(description = "分段数", requiredMode = Schema.RequiredMode.REQUIRED, example = "25319")
    @ExcelProperty("分段数")
    private Integer completedSegments;

    @Schema(description = "命中次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "26583")
    @NotNull(message = "命中次数不能为空")
    private Integer hitCount;

    @Schema(description = "索引状态（waiting 等待/indexing 正在处理/completed 已完成/failed 失败）", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @NotEmpty(message = "索引状态（waiting/indexing/completed/failed）不能为空")
    private String indexingStatus;

    /**
     * 解析状态枚举：
     * – "0" / "UNSTART"：未开始
     * – "1" / "RUNNING"：进行中
     * – "2" / "DONE"：完成
     * – "3" / "FAIL"：失败
     */
    private String ragflowStatus;

    @Schema(description = "索引方式（high_quality/economy）", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "索引方式（high_quality/economy）不能为空")
    private String indexingTechnique;

    @Schema(description = "文档形式（text_model/hierarchical_model/qa_model）", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "文档形式（text_model/hierarchical_model/qa_model）不能为空")
    private String docForm;

    @Schema(description = "文档语言（qa_model 模式下）")
    private String docLanguage;

    @Schema(description = "清洗 & 分段规则（JSON）")
    private String processRule;

    @Schema(description = "检索模型配置（首次上传使用）")
    private String retrievalModel;

    @Schema(description = "Embedding 模型名称")
    private String embeddingModel;

    @Schema(description = "Embedding 模型提供商")
    private String embeddingModelProvider;

}