package com.sundot.airport.exam.enums;

import com.sundot.airport.common.exception.ServiceException;

/**
 * 题目类型枚举
 */
// 题目类型枚举
public enum QuestionTypeEnum {
    SINGLE("单选题", "SINGLE"),
    MULTIPLE("多选题", "MULTIPLE"),
    JUDGMENT("判断题", "JUDGMENT"),
    FILL_BLANK("填空题", "FILL_BLANK"),
    CONNECTION("连线题", "CONNECTION");

    private  String displayName;
    public  String dbValue;

    QuestionTypeEnum(String displayName, String dbValue) {
        this.displayName = displayName;
        this.dbValue = dbValue;
    }

    public static QuestionTypeEnum fromDisplayName(String displayName) {
        for (QuestionTypeEnum value : values()) {
            if (value.displayName.equals(displayName)) {
                return value;
            }
        }
        throw new ServiceException("不支持的题型: " + displayName);
    }
}
