package com.lantone.security.enums;

import com.lantone.common.constant.KeyedNamed;
import lombok.Setter;

/**
 * @Description: 字典分组注解
 * @Author songxl
 * @Date 2021/7/21
 */
public enum DictionaryEnum implements KeyedNamed {
    TITLE(40, "职称"),
    HOSPITAL_TYPE(43, "组织类型"),
    PASSWORD(44, "密码相关"),
    REGION(45, "病区"),
    MANAGE_HIDE_MENU(46, "管理隐藏功能菜单"),
    STATUS(47, "启用禁用"),
    DATA_AUTH(48, "数据权限"),
    NOTICE_TYPE(50, "通知类型"),
    NOTICE_STATUS(51, "通知状态"),
    NOT_SHOW_MENU(41,"不显示菜单");

    @Setter
    private int key;

    @Setter
    private String name;

    DictionaryEnum(int key, String name) {
        this.key = key;
        this.name = name;
    }

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

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

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

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