package com.qxgmat.data.constants.enums.module;

public enum QuestionModule {
    BASE("base"), // 练习、模考、错题、收藏、预习作业
    TEXTBOOK("textbook"), // 机经
    SENTENCE("sentence"), // 长难句
    ;
    public String key;
    private QuestionModule(String key){
        this.key = key;
    }

    public static QuestionModule ValueOf(String name){
        if (name == null) return null;
        return QuestionModule.valueOf(name.toUpperCase());
    }

    /**
     * 根据paper类型判断组卷题目类型
     * @param module
     * @return
     */
    public static QuestionModule WithPaper(PaperModule module){
        switch(module){
            case SENTENCE:
                return SENTENCE;
            case TEXTBOOK:
                return TEXTBOOK;
            case ERROR:
            case COLLECT:
            case EXERCISE:
            case EXAMINATION:
            case PREVIEW:
                return BASE;
            default:
                return null;
        }
    }
}
