package com.ruoyi.common.enums;

import com.ruoyi.common.utils.StringUtils;

/**
 * 错题来源类型
 * @author mo
 *
 */
public enum EnumWrongAnswersSource {
    Evaluation(0, "大数据导学"),
    AI(1, "AI匹配"),
    Competitior(2, "竞赛"),

    ;

    private int value;
    private String remark;

    private EnumWrongAnswersSource(int value, String remark) {
        this.value = value;
        this.remark = remark;
    }

    public int getValue() {
        return value;
    }

    public String getRemark() {
        return remark;
    }

    public static EnumWrongAnswersSource getByValue(int value) {
        for (EnumWrongAnswersSource o : EnumWrongAnswersSource.values()) {
            if (o.getValue() == value) {
                return o;
            }
        }
        return null;
    }

    public static EnumWrongAnswersSource getByName(String name) {
        for (EnumWrongAnswersSource o : EnumWrongAnswersSource.values()) {
            if (o.name().equalsIgnoreCase(name)) {
                return o;
            }
        }
        return null;
    }

    public static String getRemarkByName(String name) {
        if(StringUtils.isBlank(name)){
            return name;
        }

        for (EnumWrongAnswersSource o : EnumWrongAnswersSource.values()) {
            if (o.name().equalsIgnoreCase(name)) {
                return o.getRemark();
            }
        }
        return name;
    }

    public static void main(String[] args) {
        System.out.println(getRemarkByName("evaluation"));
        System.out.println(getRemarkByName("高三数学下学期期末测试"));
    }
}
