package com.ozs.mdm.constant;

import java.util.HashMap;

/**
 * @author 宋显哲
 * @version 1.0.0 创建于 2018/6/19
 **/
public class StatusCode {

    /**
     * 请求成功
     */
    public static final String SUCCESS = "1";
    /**
     * 请求失败
     */
    public static final String FAILURE = "-1";


    /**
     * 权限不允许
     */
    public static final String NO_AUTH = "100101";
    /**
     * 令牌异常
     */
    public static final String TOKEN_ERROR = "100102";
    /**
     * 令牌配置异常
     */
    public static final String TOKEN_EXPIRE_TIME_NULL = "100103";
    /**
     * 令牌超时
     */
    public static final String TOKEN_EXPIRE_TIMEOUT = "100104";
    /**
     * 令牌被篡改
     */
    public static final String TOKEN_ALTERED = "100105";

    /**
     * 用户不存在
     */
    public static final String USER_NOT_EXIST = "100201";

    /**
     * 用户所属企业失效
     */
    public static final String USER_ENT_EXPIRED = "100208";

    //广告组业务状态
    public static final Integer AD_GROUP_BUSINESS_STATUS_EFFEC = 1;
    public static final Integer AD_GROUP_BUSINESS_STATUS_OFFLINE = 2;
    public static final Integer AD_GROUP_SYS_STATUS_SART = 1;
    public static final Integer AD_GROUP_SYS_STATUS_STOP = 2;

    private static final HashMap<String, String> codeMsg = new HashMap<String, String>() {
        {
            put(SUCCESS, "请求成功.");
            put(FAILURE, "请求失败.");

            put(USER_NOT_EXIST, "用户不存在.");
            put(USER_ENT_EXPIRED, "用户所属企业失效.");
            put(NO_AUTH, "权限不允许.");
            put(TOKEN_ERROR, "令牌异常.");
            put(TOKEN_EXPIRE_TIME_NULL, "令牌配置异常.");
            put(TOKEN_EXPIRE_TIMEOUT, "令牌超时.");
            put(TOKEN_ALTERED, "令牌被篡改.");

        }

    };

    /**
     * 根据状态码获取提示信息.
     *
     * @param code 状态吗
     * @return 返回状态码对应的提示信息
     */
    public static String getMsg(String code) {
        return codeMsg.get(code);
    }
}
