package cn.constant;

import cn.util.time.TimeKit;

public class CommonConst
{
	/**PC登录
	 * 当前登录用户UserDetailsImpl
	 * cn.component.lnterceptor AuthenticationInterceptor拦截设置[security]
	 */
	public final static String CURRENT_USER = "CURRENT_USER";

	//表的单一默认主键字段名
	public static final String DEFAULT_PRIMARY_KEY = "id";
	//(超级)管理员的默认权限字符串(t_sys_role.role_key)
	public static final String DEFAULT_ADMIN = "admin";
	//默认密码
	public static final String DEFAULT_PWD = "123456";

	/**默认时间*/
	public static final String DATETIME_DEFAULT = TimeKit.getNowHMS();
	public static final String DATE_DEFAULT = TimeKit.getToday();

	/* 与表中字段char(1)对应
	 * 对应表中status字段：0正常(解冻) 1冻结
	 * 对应表中del_flag字段：0未删除 1逻辑删除
	 * 对应表中read_flag阅读状态：0未读，1已读  CommonConst.CHAR_NORMAL
	 * 消息类型: 1:通知公告; 2:系统消息
	 * 发布状态: 0未发布; 1已发布;2已撤销
	 */
	public static final String CHAR_NUM_0 = "0";
	public static final String CHAR_NUM_1 = "1";
	public static final String CHAR_NUM_2 = "2";

	/**与表中有关字段int(1)对应
	 * 是否：1否； 0是
	 */
	public static final Integer INT_NUM_0 = 0;
	public static final Integer INT_NUM_1 = 1;

	/**优先级（L低，M中，H高）*/
	public static final String PRIORITY_L  = "L";
	public static final String PRIORITY_M  = "M";
	public static final String PRIORITY_H  = "H";

	/**通告对象类型（USER:指定用户，ALL:全体用户）*/
	public static final String MSG_TYPE_UESR  = "USER";
	public static final String MSG_TYPE_ALL  = "ALL";

	/**Layout组件标识*/
	public final static String LAYOUT = "Layout";
	/**菜单类型（菜单）*/
	public static final String TYPE_MENU = "C";
	/**菜单类型（目录）*/
	public static final String TYPE_DIR = "M";

	/**测试缓存key*/
	public static final String TEST_DEMO_CACHE = "test:demo";
	/** 登录用户Token令牌缓存KEY前缀 */
	public static final String PREFIX_USER_TOKEN = "prefix_user_token_";
	/**缓存用户信息*/
	public static final String SYS_USERS_CACHE = "sys:cache:user";
	/**字典管理 cache key*/
	public static final String SYS_DICT_KEY = "sys_dict:";

	/***令牌自定义标识*/
	public static final String TOKEN_HEADER = "Authorization";
	/**令牌前缀*/
	public static final String LOGIN_USER_KEY = "login_user_key";
	/**令牌前缀*/
	public static final String TOKEN_PREFIX = "Bearer ";
	/**令牌前缀*/
	public static final String SESSION_KEY = "session_key";
	/**令牌*/
	public static final String TOKEN = "token";  
	/**令牌秘钥*/
	public static final String TOKEN_SECRET = "abcdefghijklmnopqrstuvwxyz";
	public final static String X_ACCESS_TOKEN = "X-Access-Token";

	/**Token缓存时间：3600秒即一小时
	 * 10*60*MILLIS_MINUTE = 10小时
	 * TOKEN_SCALE * MILLIS_SECOND = 30分钟
	 * */
	public static final Integer TOKEN_SCALE = 30*60;
	public static final long MILLIS_SECOND = 1000; //1秒
	public static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;//1分
	/**Token过期时间30分钟（用户登录过期时间是此时间的两倍，以token在reids缓存时间为准*/
	public static final long EXPIRE_TIME = 21600 * 60 * 1000;

	/**验证码有效期（分钟)*/
	public static final Integer CAPTCHA_EXPIRATION = 2;
	/** 验证码 redis key*/
	public static final String CAPTCHA_CODE_KEY = "captcha_codes:";

	/**登录用户 redis key*/
	public static final String LOGIN_TOKEN_KEY = "login_tokens:";
	/**登录成功*/
	public static final String LOGIN_SUCCESS = "Success";
	/**注销*/
	public static final String LOGOUT = "Logout";
	/** 登录失败*/
	public static final String LOGIN_FAIL = "Error";

	/**
	 * 文件上传类型（本地：local，Minio：minio，阿里云：alioss）
	 */
	public static final String UPLOAD_TYPE_LOCAL = "local";
	public static final String UPLOAD_TYPE_MINIO = "minio";
	public static final String UPLOAD_TYPE_OSS = "alioss";
}
