package com.diagbot.enums;

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

/**
 * @Description:检索显示类型枚举类
 * @author: zhoutg
 * @Date: 2018/10/26 10:35
 */
public enum ShowTypeEnum implements KeyedNamed {

    ITSELF(1, "本体"),
    SYNONYMS(2, "同义词");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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