package com.diagbot.enums;

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

/**
 * @Description:标签显示类型
 * @Author:zhoutg
 * @time: 2018/11/21 11:39
 */
public enum TagTypeEnum implements KeyedNamed {
    T1(1, "单项单列"),
    T2(2, "单项多列"),
    T3(3, "横铺单标签形式"),
    T4(4, "横铺多标签形式"),
    T5(5, "竖铺组合项"),
    T6(6, "组合项多列"),
    T7(7, "化验类型"),
    T8(8, "文字标签"),
    T9(9, "空标签"),
    T10(10, "组合项标签"),
    T11(11, "推送类型");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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