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

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;

@Schema(description = "管理后台 - 知识库文档 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ChatDocumentRespVO {

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

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

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

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

    @Schema(description = "知识库 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26727")
    @ExcelProperty("知识库 ID")
    private Integer datasetId;

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

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

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

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

    @Schema(description = "文档名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "木易")
    @ExcelProperty("文档名称")
    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)
    @ExcelProperty("创建来源（upload/api）")
    private String createdFrom;

    @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建者")
    private String createdBy;

    @Schema(description = "创建时间（业务）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间（业务）")
    private LocalDateTime createdAt;

    @Schema(description = "总 Token 数", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("总 Token 数")
    private Integer tokens;

    @Schema(description = "文档字数", requiredMode = Schema.RequiredMode.REQUIRED, example = "25319")
    @ExcelProperty("文档字数")
    private Integer wordCount;


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

    @Schema(description = "命中次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "26583")
    @ExcelProperty("命中次数")
    private Integer hitCount;

    @Schema(description = "索引状态（waiting/indexing/completed/failed）", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty("索引状态（waiting/indexing/completed/failed）")
    private String indexingStatus;

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

    @Schema(description = "显示状态（queuing/processing/ready 等）", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty("显示状态（queuing/processing/ready 等）")
    private String displayStatus;

    @Schema(description = "错误信息")
    @ExcelProperty("错误信息")
    private String error;

    @Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("是否启用")
    private Boolean enabled;

    @Schema(description = "禁用时间")
    @ExcelProperty("禁用时间")
    private LocalDateTime disabledAt;

    @Schema(description = "禁用者")
    @ExcelProperty("禁用者")
    private String disabledBy;

    @Schema(description = "是否归档", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("是否归档")
    private Boolean archived;

    @Schema(description = "索引方式（high_quality/economy）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("索引方式（high_quality/economy）")
    private String indexingTechnique;

    @Schema(description = "文档形式（text_model/hierarchical_model/qa_model）", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("文档形式（text_model/hierarchical_model/qa_model）")
    private String docForm;

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

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

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

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

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

}