package jnpf.enums.cultivate;

import lombok.Getter;

import java.util.Objects;

/**
 * 鉴定来源(0手动发起，1课程学习鉴定，2岗位学习鉴定)
 */
@Getter
public enum ApplySourceEnum {
    SDFQ(0, "手动发起"),
    KCXX(1, "课程学习鉴定"),
    GWXX(2, "岗位学习鉴定"),
    APPLY_IN_PERSON(3, "本人申请"),
    TASK(4, "任务鉴定");
    @Getter
    final Integer code;
    final String msg;


    ApplySourceEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getMsg(Integer code) {
        ApplySourceEnum[] values = ApplySourceEnum.values();
        for (ApplySourceEnum value : values) {
            if (Objects.equals(value.getCode(), code)) {
                return value.getMsg();
            }
        }
        return null;
    }

    public static ApplySourceEnum getEnum(int code) {
        ApplySourceEnum[] values = ApplySourceEnum.values();
        for (ApplySourceEnum value : values) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }
}
