package com.qmth.themis.business.enums;

/**
 * @Description: 题目类型 enum
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/10/21
 */
public enum QuestionTypeEnum {

    /**
     * 单选
     */
    SINGLE_ANSWER_QUESTION(1, "单选题"),
    /**
     * 多选
     */
    MULTIPLE_ANSWER_QUESTION(2, "多选题"),
    /**
     * 判断
     */
    BOOL_ANSWER_QUESTION(3, "判断题"),
    /**
     * 填空
     */
    FILL_BLANK_QUESTION(4, "填空题"),
    /**
     * 问答
     */
    TEXT_ANSWER_QUESTION(5, "问答题"),
    /**
     * 套题
     */
    NESTED_ANSWER_QUESTION(6, "套题"),
    /**
     * 听力
     */
    EAR_ANSWER_QUESTION(7, "听力题"),
    /**
     * 配对
     */
    PAIR_ANSWER_QUESTION(8, "配对题");

    private Integer type;

    private String title;

    private QuestionTypeEnum(Integer type, String title) {
        this.type = type;
        this.title = title;
    }

    /**
     * 状态转换 toTitle
     *
     * @param value
     * @return
     */
    public static String convertToTitle(Integer value) {
        for (QuestionTypeEnum e : QuestionTypeEnum.values()) {
            if (value.intValue() == e.getType().intValue()) {
                return e.getTitle();
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public String getTitle() {
        return title;
    }
}
