package jnpf.model.cultivate.v2.enums;

import lombok.Getter;

/**
 * 题型枚举
 * 题型(1: 单选, 2: 多选, 3: 判断, 4: 填空, 5: 问题, 6: 不定项)
 * @author yanwenfu
 * @create 2026-03-04
 */
@Getter
public enum QuestionTypeEnum {

    /** 单选 */
    SINGLE_CHOICE(1, "单选题"),

    /** 多选 */
    MULTIPLE_CHOICE(2, "多选题"),

    /** 判断 */
    JUDGMENT(3, "判断题"),

    /** 填空 */
    FILL_BLANK(4, "填空题"),

    /** 问题 */
    QUESTION(5, "问答题"),

    /** 组合题 */
    COMB_ITEM(6, "组合题"),

    /** 不定项选择题 */
    NON_FIXED_ITEM(7, "不定项选择题"),
    ;

    private final Integer code;
    private final String description;

    QuestionTypeEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static QuestionTypeEnum getByCode(Integer code) {
        for (QuestionTypeEnum statusEnum : values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }
}
