package jnpf.model.cultivate.v2.promotion.vo;

import jnpf.permission.vo.v2.position.PositionAndGradesVO;
import jnpf.util.StringUtil;
import lombok.Data;


@Data
public class V2CultivatePromotionPostNewVO {

    /**
     * id
     */
    private String id;
    /**
     * 晋升通道主键id
     */
    private String promotionId;

    /**
     * 岗位id
     */
    private String postId;
    /**
     * 岗位名称
     */
    private String postName;

    /**
     * 职级id
     */
    private String gradeId;

    /**
     * 职级名称
     */
    private String gradeName;

    /**
     * 阶段号
     */
    private Integer channelLevel;

    /**
     * 选学数量(根据选学数量控制学习数量)
     */
    private Integer selectCourseNumber;

    /**
     * 状态 0-正常 1-不存在了
     */
    private Integer status;

    public void fillPositionAndGradesName(PositionAndGradesVO positionAndGradesVO) {
        this.postName = positionAndGradesVO.getFullName();
        if(StringUtil.isNotEmpty(this.gradeId)){
            positionAndGradesVO.getList().forEach(gradeVO -> {
                if(gradeVO.getId().equals(this.gradeId)){
                    this.gradeName = gradeVO.getFullName();
                }
            });
        }
    }
}
