package com.cool.store.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * @author Fun Li
 * @version 1.0
 * @date 2023/7/19 17:55
 */
public enum ExamStatusEnum {

    NOT_START(0, "未开始"),
    PASS(1, "正考通过"),
    NOT_PASS(2, "不通过");

    private Integer code;

    private String desc;

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

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static Integer matchCodeByDesc(String desc) {
        if(StringUtils.isBlank(desc)){
            return null;
        }
        for (ExamStatusEnum statusEnum : ExamStatusEnum.values()) {
            if (statusEnum.getDesc().equals(desc)) {
                return statusEnum.code;
            }
        }
        return null;
    }


}
