package jnpf.model.cultivate.dto.promotion;

import jnpf.model.cultivate.po.promotion.FtbCultivatePromotionMemberNew;
import jnpf.permission.vo.v2.user.UserBoundVO;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @Title: FtbCultivateCreatMeMapInfoDTO
 * @Author: peng.hao
 * @create: 2024/4/7 13:57
 */
@Data
public class FtbCultivateCreatMeMapInfoDTO {
    /**
     * 学习地图主键id
     */
    @NotNull(message = "学习地图主键id不能为空")
    private String promotionId;
    /**
     * 学习地图岗位id
     */
    @NotNull(message = "学习地图岗位id不能为空")
    private List<String> studyMapJobId;
    /**
     * 当前学习地图级别
     */
    @NotNull(message = "当前学习地图级别不能为空")
    private Integer level;
    /**
     * 组织id
     */
    private String orgId;
    /**
     * 组织名称
     */
    private String orgName;
    /**
     * 岗位id
     */
    private String postId;
    /**
     * 岗位名称
     */
    private String postName;
    /***
     * 职等id
     */
    private String gradeId;
    /**
     * 职等名称
     */
    private String gradeName;
    /**
     * 用户id
     */
    @NotNull(message = "用户id不能为空")
    private String userId;
    /**
     * 用户名称
     */
    @NotNull(message = "用户名称不能为空")
    private String userName;

    public static FtbCultivatePromotionMemberNew covert(FtbCultivateCreatMeMapInfoDTO creatMeMapInfoDTO) {
        if (creatMeMapInfoDTO == null) {
            return null;
        }
        FtbCultivatePromotionMemberNew ftbCultivatePromotionMemberNew = new FtbCultivatePromotionMemberNew();
        ftbCultivatePromotionMemberNew.setPromotionId(creatMeMapInfoDTO.getPromotionId());
        ftbCultivatePromotionMemberNew.setOrgId(creatMeMapInfoDTO.getOrgId());
        ftbCultivatePromotionMemberNew.setOrgName(creatMeMapInfoDTO.getOrgName());
        ftbCultivatePromotionMemberNew.setPositionId(creatMeMapInfoDTO.getPostId());
        ftbCultivatePromotionMemberNew.setPositionName(creatMeMapInfoDTO.getPostName());
        ftbCultivatePromotionMemberNew.setGradeId(creatMeMapInfoDTO.getGradeId());
        ftbCultivatePromotionMemberNew.setGradeName(creatMeMapInfoDTO.getGradeName());
        ftbCultivatePromotionMemberNew.setUserId(creatMeMapInfoDTO.getUserId());
        ftbCultivatePromotionMemberNew.setUserName(creatMeMapInfoDTO.getUserName());
        return ftbCultivatePromotionMemberNew;
    }

    public static FtbCultivateCreatMeMapInfoDTO covertMe(UserBoundVO partUserInfoVo) {
        if (partUserInfoVo == null) {
            return null;
        }
        FtbCultivateCreatMeMapInfoDTO meMapInfoDTO = new FtbCultivateCreatMeMapInfoDTO();
        meMapInfoDTO.setOrgId(partUserInfoVo.getId());
        meMapInfoDTO.setOrgName(partUserInfoVo.getOrganizeName());
        meMapInfoDTO.setPostId(partUserInfoVo.getPositionId());
        meMapInfoDTO.setPostName(partUserInfoVo.getPositionName());
        meMapInfoDTO.setUserId(partUserInfoVo.getId());
        meMapInfoDTO.setGradeId(partUserInfoVo.getGradeId());
        meMapInfoDTO.setGradeName(partUserInfoVo.getGradeName());
        return meMapInfoDTO;
    }
}
