package jnpf.model.personnels.dto.uchisuike.app;

import cn.hutool.core.lang.RegexPool;
import jnpf.model.cultivate.dto.offline.FtbCultivateOfflineFileDTO;
import jnpf.model.personnels.bo.FtbRosterImportConstants;
import jnpf.model.personnels.po.FtbPersonnelsUchisuikePond;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.List;

@Data
public class FtbRecommendationInvitationAppDTO {
    /**
     * 租户id
     */
    @NotBlank(message = "租户id不能为空")
    private String tenantId;
    /**
     * 姓名
     */
    @NotBlank(message = "姓名不能为空")
    @Pattern(regexp = FtbRosterImportConstants.NAME_REGEX, message = "请使用标准格式的中文名或英文名")
    private String userName;

    /**
     * 性别0男1女2未知
     */
    @NotNull(message = "性别不能为空")
    private Integer sex;

    /**
     * 身份证号码
     */
    @NotBlank(message = "身份证号码不能为空")
    @Length(min = 18, max = 18, message = "身份证号码位数不能超过18位")
    @Pattern(regexp = RegexPool.CITIZEN_ID, message = "身份证号码格式不正确")
    private String idCard;

    /**
     * 手机号码
     */
    @NotBlank(message = "手机号码不能为空")
    @Length(min = 11, max = 11, message = "手机号码长度不能超过11位")
    @Pattern(regexp = RegexPool.MOBILE, message = "手机号码格式不正确")
    private String phone;

    /**
     * 上传简历
     */
    @Size(max = 5, message = "简历附件上限5个")
    @Valid
    private List<FtbCultivateOfflineFileDTO> files;

    /**
     * 期望组织id
     */
    private String orgId;

    /**
     * 期望岗位id
     */
    private String postId;

    /**
     * 期望职等id
     */
    private String postRankId;

    /**
     * 期望薪资
     */
    private BigDecimal money;

    /**
     * 来源0员工内推,1门店/组织内推
     */
    private Long source;

    /**
     * 内推人Id
     */
    private String pushUserId;

    /**
     * 内推组织id
     */
    private String pushOrgId;

    /**
     * 期望组织名字
     */
    private String orgName;

    /**
     * 期望岗位名称
     */
    private String postName;

    /**
     * 期望职等名称
     */
    private String postRankName;

    /**
     * 内推组织名称
     */
    private String pushOrgName;


    /**
     * 招聘渠道名称多选,逗号分隔开，传汉字
     */
    private String recruitmentChannels;


    public FtbPersonnelsUchisuikePond convertFtbPersonnelsUchisuikePond(FtbRecommendationInvitationAppDTO ftbRecommendationInvitationAppDTO) {
        if (ftbRecommendationInvitationAppDTO == null) {
            return null;
        }
        FtbPersonnelsUchisuikePond ftbPersonnelsUchisuikePond = new FtbPersonnelsUchisuikePond();
        ftbPersonnelsUchisuikePond.setUserName(ftbRecommendationInvitationAppDTO.getUserName());
        ftbPersonnelsUchisuikePond.setSex(ftbRecommendationInvitationAppDTO.getSex());
        ftbPersonnelsUchisuikePond.setIdCard(ftbRecommendationInvitationAppDTO.getIdCard());
        ftbPersonnelsUchisuikePond.setPhone(ftbRecommendationInvitationAppDTO.getPhone());
        ftbPersonnelsUchisuikePond.setOrgId(ftbRecommendationInvitationAppDTO.getOrgId());
        ftbPersonnelsUchisuikePond.setPostId(ftbRecommendationInvitationAppDTO.getPostId());
        ftbPersonnelsUchisuikePond.setPostRankId(ftbRecommendationInvitationAppDTO.getPostRankId());
        ftbPersonnelsUchisuikePond.setMoney(ftbRecommendationInvitationAppDTO.getMoney());
        ftbPersonnelsUchisuikePond.setPushUserId(ftbRecommendationInvitationAppDTO.getPushUserId());
        ftbPersonnelsUchisuikePond.setPushOrgId(ftbRecommendationInvitationAppDTO.getPushOrgId());
        ftbPersonnelsUchisuikePond.setOrgName(ftbRecommendationInvitationAppDTO.getOrgName());
        ftbPersonnelsUchisuikePond.setPostName(ftbRecommendationInvitationAppDTO.getPostName());
        ftbPersonnelsUchisuikePond.setPostRankName(ftbRecommendationInvitationAppDTO.getPostRankName());
        ftbPersonnelsUchisuikePond.setPushOrgName(ftbRecommendationInvitationAppDTO.getPushOrgName());
        ftbPersonnelsUchisuikePond.setPushStoreId(ftbRecommendationInvitationAppDTO.getPushOrgId());
        ftbPersonnelsUchisuikePond.setPushStoreName(ftbRecommendationInvitationAppDTO.getPushOrgName());
        ftbPersonnelsUchisuikePond.setRecruitmentChannels(ftbRecommendationInvitationAppDTO.getRecruitmentChannels());
        return ftbPersonnelsUchisuikePond;
    }

}
