package com.lantone.security.enums;

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

/**
 * @Description: 常量枚举类
 * @Author: ztg
 * @Date: 2018/9/28 10:45
 */
public enum ConstantEnum implements KeyedNamed {

    //    INNER_USER(1, "用户-朗通"),
    //    OUTER_USER(0, "用户-客户");
    SUPER_USER(0, "用户-超级管理员");


    @Setter
    private int key;

    @Setter
    private String name;

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

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

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

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

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

