package jnpf.enums.cultivate;

import lombok.Getter;

/**
 *  0-每天 1-每周 3-每月 4-累计 5-不限
 */
@Getter
public enum ExamRetakeFrequencyEnum {
    DAILY(0, "每天"),
    WEEKLY(1, "每周"),
    MONTHLY(2, "每月"),
    CUMULATIVE(3, "累计"),
    UNLIMITED(4, "不限");
    Integer code;
    String msg;

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

    public Integer getCode() {
        return code;
    }

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

    public static ExamRetakeFrequencyEnum of(Integer code) {
        if(code==null){
            return null;
        }
        ExamRetakeFrequencyEnum[] values = ExamRetakeFrequencyEnum.values();
        for (ExamRetakeFrequencyEnum value : values) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }
}
