package jnpf.model.cultivate.v2.enums;

import lombok.Getter;

/**
 * 考试枚举 0-未开始 1-进行中，2-已结束，3-作废
 *
 * @author yanwenfu
 * @create 2026-03-04
 */
@Getter
public enum ExamStatusEnum {

    /** 未开始 */
    NOT_STARTED(0, "未开始"),

    /** 进行中 */
    IN_PROGRESS(1, "进行中"),

    /** 已结束 */
    FINISHED(2, "已结束"),

    /** 作废 */
    REVOKE(3, "作废"),
    ;

    private final Integer code;
    private final String description;

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

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