package cn.superdesk.uniorder.common.enums.login;


import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 后台登陆方法
 * @Author: linjinyu
 * @CreateDate: 2020/11/10 上午10:05
 * @UpdateUser: linjinyu
 * @UpdateDate: 2020/11/10 上午10:05
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SysLoginMethodEnum {

    统一订单后台账号(1, "system"),

    服务之窗后台账号(100, "superdesk-app"),
    服务之窗企业账号(100001, "superdesk-app"),
    服务之窗运营商账号(100002, "superdesk-app"),
    服务之窗渠道商账号(100003, "superdesk-app"),

    商城后台账号(200, "superdesk-mall"),
    商城供应商账号(200001, "superdesk-mall"),
    ;


    private Integer key;
    private String  desc;

    SysLoginMethodEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public Integer getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(Integer key) {
        for (SysLoginMethodEnum c : SysLoginMethodEnum.values()) {
            if (c.key.equals(key)) {
                return c.getDesc();
            }
        }
        return "非法输入";
    }

    private static final Map<Integer, SysLoginMethodEnum> LOOKUP = new HashMap<>();

    static {
        for (SysLoginMethodEnum s : EnumSet.allOf(SysLoginMethodEnum.class)) {
            LOOKUP.put(s.getKey(), s);
        }
    }

    public static SysLoginMethodEnum get(Integer key) {
        return LOOKUP.get(key);
    }

}
