package jnpf.model.personnels.dto.config;

import jnpf.model.personnels.po.FtbPersonnelsAuditMasterConfig;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @Title:FtbPersonnelsAuditMasterConfigDTO
 * @Author:peng.hao
 * @create: 2024/2/210:53
 */
@Data
public class FtbPersonnelsAuditConfigDTO {


    /**
     * 主键id
     */
    private String id;

    /**
     * 组织id
     */
    @NotBlank(message = "组织id不能为空")
    private String orgId;
    /**
     * 组织id
     */
    private String orgName;
    /**
     * 1 审批配置类型 2 入职审批配置  3转正审批配置  4调岗审批配置 5离职审批配置 6晋升审批配置
     */
    private Integer configType;

    /**
     * 抄送人 最多50个人抄送 json格式存储
     */
    @Size(min = 1, max = 50, message = "抄送人最大不能超过50个人")
    private List<FtbPersionnelsSendCranbonCopy> copyRecipient;


    /**
     * 一人审批通过即视为该流程全部审批通过(0否,1是)
     */
    private Integer isOnePersonPasses;

    /**
     * 是否填写审批意见 (0否,1是)
     */
    private Integer isApprovalComments;
    /**
     * 审批人
     */
    @Size(max = 50, message = "审批人最大不能超过50个人")
    private List<FtbPersonnelsAuditConfigInfoDTO> configInfo;

    public static FtbPersonnelsAuditMasterConfig coverFtbPersonnelsAuditMasterConfig(FtbPersonnelsAuditConfigDTO dto) {
        if (dto == null) {
            return null;
        }
        FtbPersonnelsAuditMasterConfig ftbPersonnelsAuditMasterConfig = new FtbPersonnelsAuditMasterConfig();
        ftbPersonnelsAuditMasterConfig.setId(dto.getId());
        ftbPersonnelsAuditMasterConfig.setOrgId(dto.getOrgId());
        ftbPersonnelsAuditMasterConfig.setConfigType(dto.getConfigType());
        ftbPersonnelsAuditMasterConfig.setIsOnePersonPasses(dto.getIsOnePersonPasses());
        ftbPersonnelsAuditMasterConfig.setIsApprovalComments(dto.getIsApprovalComments());
        return ftbPersonnelsAuditMasterConfig;
    }
}
