package com.diagbot.enums;

import com.diagbot.core.KeyedNamed;
import lombok.Setter;

/**
 * @author wangfeng
 * @Description: TODO
 * @date 2018年11月21日 下午2:31:42
 */
public enum AbnormalTypeEnum implements KeyedNamed {
    DATA_MODEL(1, "数据模块"),
    QC_TYPE(2, "质控类型"),
    XML(3, "XML结构");

    @Setter
    private int key;

    @Setter
    private String name;

    AbnormalTypeEnum(int key, String name) {
        this.key = key;
        this.name = name;
    }

    public static AbnormalTypeEnum getEnum(int key) {
        for (AbnormalTypeEnum item : AbnormalTypeEnum.values()) {
            if (item.key == key) {
                return item;
            }
        }
        return null;
    }

    public static String getName(int key) {
        AbnormalTypeEnum item = getEnum(key);
        return item != null ? item.name : null;
    }

    @Override
    public int getKey() {
        return key;
    }

    @Override
    public String getName() {
        return name;
    }
}

