/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights reserved. <a>http://www.crunii.com</a>
 */
package com.crunii.micro.common.constants;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author 田平 create 2018年10月10日下午6:17:08
 */
public class CommonConstants {
	/**
	 * //有效
	 */
	public static final int STATE_VALID = 1;
	/**
	 * //无效
	 */
	public static final int STATE_INVALID = 0;

	/**
	 * 状态：1是  0否
	 */
	public static final int STATE_YES = 1;
	public static final int STATE_NO = 0;
	/**
	 * //普通完全匹配
	 */
	public static final int URL_TYPE_COMMON = 1;
	/**
	 * //Ant匹配
	 */
	public static final int URL_TYPE_ANT = 2;
	/**
	 * //需要操作日志
	 */
	public static final int LOG_FLAG_YES = 1;
	/**
	 * //不需要操作日志
	 */
	public static final int LOG_FLAG_NO = 0;

	public static final String API_VERSION_GRAY = "gray";

	public static final String API_VERSION_DEFAULT = "default";

	public static final String API_VERSION = "apiVersion";

	public static final String WF_ENGINE_CLUSTER_SERIAL_NO = "WF_ENGINE_CLUSTER_SERIAL_NO";

	public static final String TYPE_CLIENT = "CLIENT";

	public static final String TYPE_SERVER = "SERVER";

	public static final String RESULT_SUCCESS = "SUCCESS";

	public static final String RESULT_FAILURE = "FAILURE";

	public static final String AUTH_PATTERN = "/**/auth/**";

	/**
	 * 是否是需要授权的url
	 */
	public static final String HEADER_IS_NEED_AUTH_URL = "is_need_auth_url";

	public static final String HEADER_TOKEN = "token";
	/**
	 * 当前用户的信息的json字符串，不包含权限相关信息 roles urls treeNodes
	 */
	public static final String HEADER_CURRENT_USER = "CURRENT_USER_JSON_STRING";

	public static final String HEADER_INNER_AUTH_TOKEN = "inner_auth_token";

	public static final String INNER_AUTH_TOKEN = "xoxntfvsakqtrlfwdtegvzab";

	public static final String SCOPE_WEB = "WEB";

	public static final String SCOPE_PHONE = "PHONE";

	public static final String SCOPE_SSO = "SSO";

	public static final String LOGIN_TYPE_SMS = "1";

	public static final String LOGIN_TYPE_PASSWORD = "0";

	public static final Map<String,String> LOGIN_TYPE_MAP = new HashMap();
	static {
		LOGIN_TYPE_MAP.put(LOGIN_TYPE_SMS,"短信验证码登录");
		LOGIN_TYPE_MAP.put(LOGIN_TYPE_PASSWORD,"密码登录");
	}

	// 登录成功
	public static final int LOGIN_SUCCESS = 1;
	// 未注册用户
	public static final int LOGIN_FAIL_NOT_REG = 0;
	// 登录失败、错误的密码、或被锁定
	public static final int LOGIN_FAIL_ERR_PWD = -1;
	// 登录失败、错误的短信验证码
	public static final int LOGIN_FAIL_ERR_SMS_CODE = -2;
	// 风险请求-登录失败、错误的客户端类型
	public static final int LOGIN_FAIL_ERR_SCOPE = -3;
	// 用户已失效
	public static final int LOGIN_FAIL_INVALID_USER = -4;
	// 风险请求-解密失败
	public static final int LOGIN_FAIL_ERR_DECRYPTION = -5;


	public static final List<Integer> SUPER_LOGIN_IDS = new ArrayList<Integer>();


	/**
	 * 公共组权限
	 */
	public static List<Integer> COMMON_GROUP_IDS = new ArrayList<>();
	static {
		/**
		 * // 超级用户id可以配置多个
		 */
		SUPER_LOGIN_IDS.add(9999);

		COMMON_GROUP_IDS.add(9999);
		COMMON_GROUP_IDS.add(9998);
	}

	public static final String SUPER_LOGIN_IDS_SQL = SUPER_LOGIN_IDS.stream().map(id -> id.toString()).collect(Collectors.joining(",", "(", ") "));
	/**
	 * // 最大的手机终端数
	 */
	public static final int MAX_PHONE_CLIENT = 20;

	/**
	 * // 根菜单编码
	 */
	public static final String ROOT_NODE_ID = "1";

	/**9998
	 * 公共权限角色ID，新建员工的公共权限（如修改密码等，没有对应的左侧的菜单）
	 */
	public static final Integer COMMON_ROLE_ID = 9999;


	/**
	 *
	 */
	public static final int MENU_TYPE_DIR = 0;
	/**
	 * //菜单
	 */
	public static final int MENU_TYPE_MENU = 1;
	/**
	 * //按钮
	 */
	public static final int MENU_TYPE_BUTTON = 2;

	/**
	 * 在用户手动输入id值的情况下,关闭实体id生成策略
	 */
	public static final String TURN_OFF_AUTO_ID = "0";

	/**
	 * obs_file表的对应业务CODE编码————纪实系统业务编码
	 */
	public static final String OBS_FILE_RECORD_CODE = "RECORD_ACTUAL_EVENTS";

	/**
	 * obs_file表的对应业务CODE编码————图绘青春业务编码
	 */
	public static final String OBS_FILE_PIC_YOUTH_CODE = "RECORD_PIC_YOUTH";

	/**
	 * obs_file表的对应业务CODE编码————赛事业务编码
	 */
	public static final String OBS_FILE_MATCH_CODE = "RECORD_MATCH";

	/**
	 * obs_file表的对应业务CODE编码————用户头像
	 */
	public static final String OBS_FILE_HEAD_PIC = "OBS_FILE_HEAD_PIC";

	/**
	 * obs_file表的对应业务CODE编码————培训基地编码
	 */

	public static final String OBS_FILE_PXJD= "PXJD";

	/**
	 * 赛事签到二维码标识
	 */
	public static final String MATCH_SIGN_IDENTIFY= "QCCQ_SIGN";

	/**
	 * 活动签到二维码标识
	 */
	public static final String ACTIVITY_SIGN_IDENTIFY= "ACTIVITY_SIGN";
}
