package nckd.jxccl.base.common.enums.psms;

import java.util.HashMap;
import java.util.Map;

/**
 * 职位体系-调整类别
 * @author W.Y.C
 * @date 2025/10/14 10:35
 * @version 1.0
 */
public enum AdjustTypeEnum {

    //升级2;保级1;降级0;首次聘任3;序列变化4;聘任下调5;总分不足6;无聘任7;无考核结果8
    /**降级*/
    DOWN_LEVEL("0", "降级"),
    /**升级*/
    UP_LEVEL("2", "升级"),
    /**保级*/
    KEEP_LEVEL("1", "保级"),
    /**首次聘任*/
    FIRST_EMPLOYMENT("3", "首次聘任"),
    /**序列变化*/
    SEQUENCE_CHANGE("4", "序列变化"),
    /**聘任下调*/
    EMPLOYMENT_DOWN("5", "聘任下调"),
    /**总分不足*/
    TOTAL_SCORE_NOT_ENOUGH("6", "总分不足"),
    /**无聘任*/
    NO_EMPLOYMENT("7", "无聘任"),
    /**无考核结果*/
    NO_ASSESSMENT_RESULT("8", "无考核结果");

    private static final Map<String, AdjustTypeEnum> CODE_MAP = new HashMap<>();

    static {
        for (AdjustTypeEnum value : AdjustTypeEnum.values()) {
            CODE_MAP.put(value.code, value);
        }
    }

    private final String code;
    private final String name;

    AdjustTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据编码获取枚举
     * @param code
     * @return: AdjustTypeEnum
     * @author W.Y.C
     * @date: 2025/09/12 14:33
     */
    public static AdjustTypeEnum getByCode(String code) {
        if (code == null) {
            return null;
        }
        return CODE_MAP.get(code);
    }


    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
