package com.zt.plat.module.qms.resource.record.controller.admin.recordrecord.vo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.infra.api.businessfile.dto.BusinessFileWithUrlRespDTO;
import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
import com.zt.plat.module.qms.resource.record.dal.dataobject.recordapplydetail.RecordApplyDetailDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Schema(description = "管理后台 - 文件、模板、记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class RecordRecordRespVO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4317")
    @ExcelProperty("主键")
    private Long id;

    @Schema(description = "分类id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7849")
    @ExcelProperty("分类id")
    private Long categoryId;

    @Schema(description = "文件编号", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("文件编号")
    private String code;

    @Schema(description = "业务类型")
    @ExcelProperty("业务类型")
    private String businessType;

    @Schema(description = "表单key")
    @ExcelProperty("表单key")
    private String formKey;

    @Schema(description = "文件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
    @ExcelProperty("文件名称")
    private String name;

    @Schema(description = "版本", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("版本")
    private String version;

    @Schema(description = "是否最新版本,默认显示最新版本", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("是否最新版本,默认显示最新版本")
    @Dict(dicCode = "yes_or_no")
    private Integer currentFlag;

    @Schema(description = "编制日期")
    @ExcelProperty("编制日期")
    private LocalDateTime makeDate;

    @Schema(description = "是否涉密", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("是否涉密")
    @Dict(dicCode = "yes_or_no")
    private Integer confidentialFlag;

    @Schema(description = "密级")
    @ExcelProperty("密级")
    private String confidentialLevel;

    @Schema(description = "加密方式")
    @ExcelProperty("加密方式")
    private String confidentialWay;

    @Schema(description = "秘钥")
    @ExcelProperty("秘钥")
    private String confidentialKey;

    @Schema(description = "是否长期有效", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("是否长期有效")
    @Dict(dicCode = "yes_or_no")
    private Integer permanently;

    @Schema(description = "是否需要提交(用来判断文件是否需要走流程)")
    @Dict(dicCode = "yes_or_no")
    @ExcelProperty("是否需要提交(用来判断文件是否需要走流程)")
    private Integer submitFlag;

    @Schema(description = "文件记录状态,0: 无效，1: 有效")
    @ExcelProperty("文件记录状态,0: 无效，1: 有效")
    @Dict(dicCode = "file_record_status")
    private Integer recordStatus;

    @Schema(description = "过期日期")
    @ExcelProperty("过期日期")
    private LocalDateTime expirationDate;

    @Schema(description = "生效日期")
    @ExcelProperty("生效日期")
    private LocalDateTime effectiveDate;

    @Schema(description = "过期标识,0-有效，1-过期", example = "1")
    @ExcelProperty("过期标识,0-有效，1-过期")
    @Dict(dicCode = "yes_or_no")
    private Integer expirationStatus;

    @Schema(description = "作废标志,0-有效，1-作废")
    @ExcelProperty("作废标志,0-有效，1-作废")
    @Dict(dicCode = "yes_or_no")
    private Integer cancelFlag;

    @Schema(description = "审批状态,需要走流程的审批状态")
    @Dict(dicCode = "flow_status")
    private String applyStatus;

    @Schema(description = "流程实例Id")
    private String flowInstanceId;

    @Schema(description = "表单数据")
    @ExcelProperty("表单数据")
    private String formData;

    @Schema(description = "数据集配置ID", example = "23466")
    @ExcelProperty("数据集配置ID")
    private Long dataCollectionId;

    @Schema(description = "源文件链接", example = "https://www.iocoder.cn")
    @ExcelProperty("源文件链接")
    private String sourceUrl;

    @Schema(description = "所属部门")
    @ExcelProperty("所属部门")
    private String systemDepartmentCode;

    @Schema(description = "备注")
    @ExcelProperty("备注")
    private String remark;

    @Schema(description = "创建时间")
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @Schema(description = "原始父级ID")
    private Long mainId;

    @Schema(description = "是否可编辑")
    @ExcelProperty("是否可编辑")
    private Integer operationFlag;

    //===========临时字段=============>
    @Schema(description = "文件分类名称")
    @ExcelProperty("文件分类名称")
    private String categoryName;

    @Schema(description = "附件上传code")
    @ExcelProperty("附件上传code")
    private String fileUploadBusinessCode = "qms_resource_version_manage";

    //    ===================扩展字段=========================
    @Schema(description = "附件对象")
    private CommonResult<List<BusinessFileWithUrlRespDTO>> businessFileRet;

    /**
     * 所属分类的自定义配置（由 RecordCategoryDO.customConfig 解析而来）
     */
    @Schema(description = "所属分类的自定义配置")
    private Object customConfig;

//    ====== 文件提交申请关联字段 ======

    @Schema(description = "文件提交申请ID")
    private Long applyId;

    private List<FileRespDTO> ChangeNoticeList; //

}