package com.sckw.core.model.enums;

import com.sckw.core.model.constant.Global;

/**
 * @Description 客户端类型枚举
 * @Author dengyinghui
 * @Date 2019/4/16
 */
public enum ClientTypeEnum {
    //浏览器-官网
    pc("浏览器", "pc"),
    app("app", "app"),
    //苹果设备
    ios("苹果设备", "ios"),
    //安卓设备
    android("安卓设备",  "android"),
    //移动设备
    mobile("移动端", "mobile"),
    //第三方API调用
    api("API调用", "api"),
    //所有终端
    terminal("终端", "terminal");

    private String name;

    private String value;

    private ClientTypeEnum(String name, String value){
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

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

    public String getValue() {
        return value;
    }

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

    public static int expireTime(String clientType) {
        if (clientType.equals(pc.getValue())) {
            return Global.PC_TOKEN_EXPIRE;
        } else if (clientType.equals(ios.getValue()) || clientType.equals(android.getValue())) {
            return Global.APP_TOKEN_EXPIRE;
        } else {
            return Global.COMMON_EXPIRE;
        }
    }
}