package com.lingyue.extract.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * 来源文件定义实体
 * 
 * 模板需要的来源文件类型，用别名标识
 * 用户创建模板时自定义需要哪些来源文件
 * 
 * @author lingyue
 * @since 2026-01-23
 */
@Data
@TableName(value = "source_files", autoResultMap = true)
@Schema(description = "来源文件定义")
public class SourceFile {
    
    @Schema(description = "ID")
    @TableId
    private String id;
    
    @Schema(description = "模板ID")
    @TableField("template_id")
    private String templateId;
    
    @Schema(description = "文件别名，如'可研批复'")
    @TableField("alias")
    private String alias;
    
    @Schema(description = "文件说明")
    @TableField("description")
    private String description;
    
    @Schema(description = "允许的文件类型")
    @TableField(value = "file_types", typeHandler = JacksonTypeHandler.class)
    private List<String> fileTypes;
    
    @Schema(description = "是否必须")
    @TableField("required")
    private Boolean required;
    
    @Schema(description = "创建模板时使用的示例文件")
    @TableField("example_document_id")
    private String exampleDocumentId;
    
    @Schema(description = "显示顺序")
    @TableField("display_order")
    private Integer displayOrder;
    
    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;
}
