package com.diagbot.enums;

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

/**
 * @Description:标签类型
 * @Author:zhaops
 * @time: 2018/11/21 11:39
 */
public enum ModuleTypeEnum implements KeyedNamed {
    ChiefComplaint(1, "主诉模板"),
    HistoryOfPresentIllness(2, "现病史模板"),
    HistoryOfPresentIllnessNull(3, "现病史空模板"),
    OtherHistory(4, "其他史模板"),
    Nesting(5, "嵌套模板");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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