package com.diagbot.enums;

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

/**
 * @Description:
 * @Author:zhaops
 * @time: 2018/11/26 17:38
 */
public enum QualitativeTypeEnum implements KeyedNamed {
    Negative(0, "阴性"),
    Positive(1, "阳性");

    @Setter
    private Integer key;

    @Setter
    private String name;

    QualitativeTypeEnum(Integer key, String name) {
        this.key = key;
        this.name = name;
    }

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

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

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

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