package com.sdtool.common.datas;

public enum TokenUserFrom {

    /**
     * PC端ERP用户，包括admin、业务操作
     */
    PC_ERP_ADMIN("PC端后台管理网站", "PC.ERP.Admin.commonkey", 0),

    /**
     * PC端商城后台管理网站，由我们客户的管理员、业务操作
     */
    PC_MALL_ADMIN("PC端商城管理网站", "PC.Mall.Admin.commonkey", 10),

    /**
     * PC端商城购物网站，由我们客户的客户登录报价、下单
     */
    PC_MALL_FRONT("PC端商城购物网站", "PC.Mall.Front.commonkey", 11),

    PC_PRODUCT_CENTER("PC端产品中心", "PC.Product.Center.commonkey", 20),

    PC_QD_MALL("PC端企点C客户购物网站", "PC.QD.Mall.commonkey", 30),

    PC_QD_ADMIN("PC端企点B客户网站", "PC.QD.Admin.commonkey", 31),

    PC_CLIENT_THIRDPART("PC客户绑定的三方账号", "PC.Client.ThirdPart.commonkey", 40),

    MINI_MALL("商城小程序", "Mini.Mall.commonkey", 50),

    MINI_ERP("ERP小程序", "Mini.ERP.commonkey", 51),

    /**
     * APP
     */
    APP_ERP_ADMIN("ERP手机app", "App.ERP.Admin.commonkey", 60),

    /**
     * 提供给第三方开发商的接口用户
     */
    API_ERP_CLIENT("ERP客户", "API.ERP.Client.commonkey", 70);


    private String name;

    private String tokenKey;

    private int value;

    TokenUserFrom(String name, String tokenKey, int value) {
        this.name = name;
        this.tokenKey = tokenKey;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getTokenKey() {
        return tokenKey;
    }

    public void setTokenKey(String tokenKey) {
        this.tokenKey = tokenKey;
    }

    public static TokenUserFrom getTokenUserFrom(int value) {
        for (TokenUserFrom p : TokenUserFrom.values()) {
            if (p.getValue() == value) {
                return p;
            }
        }
        return null;
    }

    public static String getName(int value) {
        for (TokenUserFrom p : TokenUserFrom.values()) {
            if (p.getValue() == value) return p.getName();
        }
        return null;
    }

    public static String getTokenKey(int value) {
        for (TokenUserFrom p : TokenUserFrom.values()) {
            if (p.getValue() == value) return p.getTokenKey();
        }
        return null;
    }
}
