package com.diagbot.enums;

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

/**
 * @Description:
 * @Author:zhaops
 * @time: 2018/11/26 17:42
 */
public enum  QuantitativeTypeEnum implements KeyedNamed {
    Normal(0, "正常"),
    Up(1, "升高"),
    Down(2, "降低");


    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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