package nckd.jxccl.hrmp.hbpm.common.hr;

import kd.hr.hbp.common.util.HRStringUtils;

/**
 * 岗位变动类型枚举
 * @author: jtd
 * @date: 2025/12/20 16:42
 */
public enum PositionChangeTypeEnum {
    ADD("1010", "岗位新设", PositionBillConstant.ADD_TAG, "新增岗位"),
    CHANGE("1020", "岗位变更", PositionBillConstant.CHANGE_TAG, "变更信息");

    private String number;
    private String name;
    private String tag;
    private String tip;

    private PositionChangeTypeEnum(String number, String name, String tag, String tip) {
        this.number = number;
        this.name = name;
        this.tag = tag;
        this.tip = tip;
    }

    public static String getNumberByTag(String tag) {
        if (tag == null) {
            return "";
        }
        for (PositionChangeTypeEnum changeTypeEnum : values()) {
            if (HRStringUtils.equals(changeTypeEnum.getTag(), tag)) {
                return changeTypeEnum.getNumber();
            }
        }
        return "";
    }

    public static String getTagByNumber(String number) {
        return getTagByNumber("", number);
    }

    public static String getTagByNumber(String prefix, String number) {
        if (number == null) {
            return "";
        }
        for (PositionChangeTypeEnum changeTypeEnum : values()) {
            if (HRStringUtils.equals(changeTypeEnum.getNumber(), number)) {
                return prefix + changeTypeEnum.getTag();
            }
        }
        return "";
    }

    public static String getTipByNumber(String number) {
        if (number == null) {
            return "";
        }
        for (PositionChangeTypeEnum changeTypeEnum : values()) {
            if (HRStringUtils.equals(changeTypeEnum.getNumber(), number)) {
                return changeTypeEnum.getTip();
            }
        }
        return "";
    }

    public static String getTipByTag(String tag) {
        if (tag == null) {
            return "";
        }
        for (PositionChangeTypeEnum changeTypeEnum : values()) {
            if (HRStringUtils.equals(changeTypeEnum.getTag(), tag)) {
                return changeTypeEnum.getTip();
            }
        }
        return "";
    }

    public String getNumber() {
        return number;
    }

    public String getName() {
        return name;
    }

    public String getTag() {
        return tag;
    }

    public String getTag(String prefix) {
        return prefix+tag;
    }

    public String getTip() {
        return tip;
    }
}
