package com.qmth.themis.business.enums;

import java.util.Objects;

/**
 * @Description: 附件enum
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/4/18
 */
public enum AttachmentEnum {

    name("姓名"),

    identity("证件号"),

    courseCode("科目代码"),

    courseName("科目名称"),

    grade("年级"),

    classNo("教学班级"),

    examActivityCode("场次"),

    roomCode("考场代码"),

    roomName("考场名称"),

    teacher1("监考账号1"),

    teacher2("监考账号2"),

    teacher3("监考账号3"),

    extendColumn("扩展字段");

    private String code;

    private AttachmentEnum(String code) {
        this.code = code;
    }

    /**
     * 状态转换 toName
     *
     * @param value
     * @return
     */
    public static String convertToName(String value) {
        for (AttachmentEnum e : AttachmentEnum.values()) {
            if (Objects.equals(value.trim(), e.code)) {
                return e.name();
            }
        }
        return null;
    }

    /**
     * 状态转换 toCode
     *
     * @param value
     * @return
     */
    public static String convertToCode(String value) {
        for (AttachmentEnum e : AttachmentEnum.values()) {
            if (Objects.equals(value.trim(), e.name())) {
                return e.code;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }
}
