package com.sundot.airport.exam.enums;

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

/**
 * <b>功能名: </b>QuesTypeEnum<br>
 * <b>说明: </b>题目类型枚举<br>
 * <b>著作权: </b> Copyright (C) 2021 HUIFANEDU  CORPORATION<br>
 * <b>修改履历: </b><br>
 *
 * @author 2021/6/17 liangxiao
 */
public enum QuesTypeEnum {

    /**
     * 单选题
     */
    SINGLE("单选"),
    /**
     * 多选题
     */
    MULTIPLE("多选"),
    /**
     * 判断题
     */
    JUDGMENT("判断"),
    /**
     * 填空题
     */
    FILL_BLANK("填空"),
    /**
     * 连线题
     */
    CONNECTION("连线");

    /**
     * 枚举中文名
     */
    private String cnName;

    QuesTypeEnum(String cnName) {
        this.cnName = cnName;
    }

    public String getCnName() {
        return cnName;
    }


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


}
