package com.casic.missiles.model.business;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.casic.missiles.annotation.DictCodeField;
import com.casic.missiles.constants.MeterDictCode;
import com.casic.missiles.dto.business.outsource.OrderSampleDTO;
import com.casic.missiles.dto.business.outsource.OrderSampleResponseDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 分包项目表
 * </p>
 *
 * @author wangpeng
 * @since 2023-03-23
 */
@ColumnWidth(30)
@HeadRowHeight(15)
@ContentRowHeight(20)
@ContentStyle(borderLeft = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN, borderTop = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
@ExcelIgnoreUnannotated
@ApiModel
@Data
@TableName("business_outsource_project")
public class BusinessOutsourceProject implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键id（列表、更新、详情接口参数）", dataType = "Long")
    @TableId("id")
    private Long id;

    @ExcelProperty("分包项目编号")
    @ApiModelProperty(value = "分包项目编号（列表、更新接口参数）", dataType = "String")
    @TableField("project_no")
    private String projectNo;

    @ExcelProperty("分包项目名称")
    @ApiModelProperty(value = "分包项目名称", dataType = "String")
    @TableField("project_name")
    private String projectName;

    @ApiModelProperty(hidden = true)
    @TableField("applicant_id")
    private Long applicantId;

    @ApiModelProperty(hidden = true)
    @TableField("checker_id")
    private Long checkerId;

    @ExcelProperty("申请人名字")
    @ApiModelProperty(hidden = true)
    @TableField("applicant_name")
    private String applicantName;

    @ExcelProperty("验收人名字")
    @ApiModelProperty(hidden = true)
    @TableField("checker_name")
    private String checkerName;

    @ApiModelProperty(value = "申请时间", dataType = "String")
    @TableField("applicant_time")
    private String applicantTime;

    @ApiModelProperty(value = "预计费用", dataType = "String")
    @TableField("pre_cost")
    private String preCost;

    @ApiModelProperty(value = "分包方id", dataType = "String")
    @TableField("outsourcer_id")
    private Long outsourcerId;

    @ExcelProperty("分包方名称")
    @ApiModelProperty(hidden = true)
    @TableField(exist = false)
    private String outsourcerName;

    @ExcelProperty("分包方编号")
    @ApiModelProperty(hidden = true)
    @TableField(exist = false)
    private String outsourcerNo;

    @DictCodeField(message = "分包原因不合法", cacheName = MeterDictCode.OUTSOURCE_REASON)
    @ApiModelProperty(value = "分包原因-字典code", dataType = "String")
    @NotBlank(message = "分包原因不能为空")
    @TableField("outsource_reason")
    private String outsourceReason;

    @ApiModelProperty(value = "分包原因-字典value", dataType = "String")
    @ExcelProperty("分包原因")
    @TableField(exist = false)
    private String outsourceReasonName;

    @ApiModelProperty(value = "预计开始时间", dataType = "String")
    @ExcelProperty("预计开始时间")
    @TableField("pre_start_time")
    private String preStartTime;

    @ApiModelProperty(value = "预计结束时间", dataType = "String")
    @ExcelProperty("预计结束时间")
    @TableField("pre_end_time")
    private String preEndTime;

    /**
     * 项目申请文件-minio存储文件名
     */
    @ApiModelProperty(value = "项目申请文件-minio存储文件名", dataType = "String")
    @TableField("apply_minio_file_name")
    private String applyMinioFileName;

    /**
     * 项目验收文件-minio存储文件名
     */
    @ApiModelProperty(hidden = true)
    @TableField("check_minio_file_name")
    private String checkMinioFileName;

    /**
     * 申请审批状态
     */
    @ApiModelProperty(hidden = true)
    @TableField("apply_approval_status")
    private String applyApprovalStatus;

    /**
     * 申请流程实例id
     */
    @ApiModelProperty(value = "流程实例id（未通过申请编辑接口必传参数）", dataType = "String")
    @TableField("apply_process_id")
    private String applyProcessId;

    /**
     * 验收审批状态
     */
    @ApiModelProperty(hidden = true)
    @TableField("check_approval_status")
    private String checkApprovalStatus;

    /**
     * 验收流程实例id
     */
    @ApiModelProperty(hidden = true)
    @TableField("check_process_id")
    private String checkProcessId;

    /**
     * 验收结论
     */
    @ApiModelProperty(hidden = true)
    @ExcelProperty("验收结论")
    @TableField("check_conclusion")
    private String checkConclusion;

    /**
     * 验收时间
     */
    @ApiModelProperty(hidden = true)
    @ExcelProperty("验收时间")
    @TableField("check_time")
    private String checkTime;

    @ApiModelProperty(value = "项目申请备注", dataType = "String")
    @ExcelProperty("项目申请备注")
    @TableField("apply_remark")
    private String applyRemark;

    @ApiModelProperty(hidden = true)
    @ExcelProperty("项目验收备注")
    @TableField("check_remark")
    private String checkRemark;

    @ApiModelProperty(hidden = true)
    @TableField("create_user")
    private Long createUser;

    /**
     * 创建时间
     */
    @ApiModelProperty(hidden = true)
    @TableField("create_time")
    private String createTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(hidden = true)
    @TableField("update_time")
    private String updateTime;

    @NotEmpty(message = "样品信息不能为空")
    @ApiModelProperty(value = "样品&委托书列表（保存/编辑草稿接口入参使用）", dataType = "List")
    @TableField(exist = false)
    private List<OrderSampleDTO> orderSampleList;

    @ApiModelProperty(value = "样品列表（详情接口出参使用）", dataType = "List")
    @TableField(exist = false)
    private List<OrderSampleResponseDTO> sampleList;
}
