package com.qmth.teachcloud.common.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * 角色类型
 *
 * @Date: 2021/3/23.
 */
public enum PdfTypeEnum {

    PAPER("试卷合并文件", "试卷"),
    CARD_A3("题卡A3合并文件", "题卡"),
    PACKAGE("卷袋贴文件", "卷袋贴"),
    SIGN("签到表文件", "签到表"),
    CHECK_IN("登记表文件", "考试情况登记表");

    PdfTypeEnum(String desc, String title) {
        this.desc = desc;
        this.title = title;
    }

    private String desc;

    private String title;

    public String getDesc() {
        return desc;
    }

    public String getTitle() {
        return title;
    }

    /**
     * @param hasAdmin 是否需要管理员
     * @return
     */
    public static List<EnumResult> listTypes(boolean hasAdmin) {
        List<EnumResult> list = new ArrayList<EnumResult>();
        for (PdfTypeEnum value : PdfTypeEnum.values()) {
            if (!hasAdmin && "ADMIN".equals(value.name())) {
                continue;
            }
            EnumResult result = new EnumResult();
            result.setName(value.name());
            result.setOrdinal(value.ordinal());
            result.setCode(null);
            result.setDesc(value.getDesc());
            list.add(result);
        }
        return list;
    }

}
