package cn.reghao.tnb.content.app.exam.model.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @author reghao
 * @date 2024-09-02 11:19:11
 */
public enum PaperViewType {
    PaperPreview(1, "试卷预览"),
    PaperExam(2, "测评预览"),
    PaperMark(3, "阅卷预览"),
    PaperResult(4, "结果预览");

    private final int code;
    private final String desc;
    private static Map<Integer, String> descMap = new HashMap<>();
    static {
        for (PaperViewType eNumber : PaperViewType.values()) {
            descMap.put(eNumber.code, eNumber.desc);
        }
    }

    PaperViewType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getName() {
        return this.name();
    }

    /**
     * 提供给 @ValidEnum 调用
     *
     * @param
     * @return
     * @date 2023-10-11 14:44:42
     */
    public int getValue() {
        return this.code;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(int code) {
        return descMap.get(code);
    }
}
