package jnpf.model.cultivate.v2.enums;

import lombok.Getter;

/**
 * 带教审批枚举
 * 补考频次类型(0: 每天, 1: 每周, 2: 每月, 3: 累计, 4: 不限)
 * @author yanwenfu
 * @create 2026-03-04
 */
@Getter
public enum FrequencyEnum {

    /** 每天 */
    EVERY_DAY(0, "day"),

    /** 每周 */
    EVERY_WEEK(1, "week"),

    /** 每月 */
    EVERY_MONTH(2, "month"),

    /** 累计 */
    TOTAL(3, "total"),

    /** 不限 */
    UNLIMITED(4, "unlimited"),
    ;

    private final Integer code;
    private final String description;

    FrequencyEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static FrequencyEnum getByCode(Integer code) {
        for (FrequencyEnum statusEnum : values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }
}
