package com.ruoyi.common.constant;

import io.jsonwebtoken.Claims;

import java.util.Locale;

/**
 * 通用常量信息
 * 
 * @author ruoyi
 */
public class Constants
{
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";

    /**
     * 系统语言
     */
    public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE;

    /**
     * www主域
     */
    public static final String WWW = "www.";

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";

    /**
     * 通用成功标识
     */
    public static final String SUCCESS = "0";

    /**
     * 通用失败标识
     */
    public static final String FAIL = "1";

    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "Success";

    /**
     * 注销
     */
    public static final String LOGOUT = "Logout";

    /**
     * 注册
     */
    public static final String REGISTER = "Register";

    /**
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";

    /**
     * 所有权限标识
     */
    public static final String ALL_PERMISSION = "*:*:*";

    /**
     * 管理员角色权限标识
     */
    public static final String SUPER_ADMIN = "admin";

    /**
     * 角色权限分隔符
     */
    public static final String ROLE_DELIMETER = ",";

    /**
     * 权限标识分隔符
     */
    public static final String PERMISSION_DELIMETER = ",";

    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 2;

    /**
     * 令牌
     */
    public static final String TOKEN = "token";

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    /**
     * 令牌前缀
     */
    public static final String LOGIN_USER_KEY = "login_user_key";

    /**
     * 用户ID
     */
    public static final String JWT_USERID = "userid";

    /**
     * 用户名称
     */
    public static final String JWT_USERNAME = Claims.SUBJECT;

    /**
     * 用户头像
     */
    public static final String JWT_AVATAR = "avatar";

    /**
     * 创建时间
     */
    public static final String JWT_CREATED = "created";

    /**
     * 用户权限
     */
    public static final String JWT_AUTHORITIES = "authorities";

    /**
     * 资源映射路径 前缀
     */
    public static final String RESOURCE_PREFIX = "/profile";

    /**
     * RMI 远程方法调用
     */
    public static final String LOOKUP_RMI = "rmi:";

    /**
     * LDAP 远程方法调用
     */
    public static final String LOOKUP_LDAP = "ldap:";

    /**
     * LDAPS 远程方法调用
     */
    public static final String LOOKUP_LDAPS = "ldaps:";

    /**
     * 自动识别json对象白名单配置（仅允许解析的包名，范围越小越安全）
     */
    public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" };

    /**
     * 定时任务白名单配置（仅允许访问的包名，如其他需要可以自行添加）
     */
    public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.quartz.task" };

    /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" };
    public static final String ONE ="1";
    public static final String TWO ="2";
    public static final String THR ="3";
    public static final String FOR ="4";
    public static final String FIV ="5";


    public static final String FRONT = "front";
    public static final String BACK = "back";

    //------------------文章的key----------------------------
    //社区资讯文章点赞的人员集合的key value = 该文章的[userId]
    public static final String ONE_LIKE ="one_like:";
    //对应用户点赞的文章key=my_like_one:{用户id} value =[资讯文章id]
    public static final String ONE_MY_LIKE ="one_my_like:";
    //社区资讯文章点赞的数量 给数据库同步数据在 redis中增加一个有过期时间的key key=one_like_count_time:{文章id}#{数量}  过期时候value获取不到
    public static final String ONE_LIKE_COUNT_TIME ="one_like_count_time:";
    //社区资讯文章点赞的数量永久key key=like_one_count:{文章id} value = 该文章的点赞数量
    public static final String ONE_LIKE_COUNT="one_like_count:";

    //------------------社区资讯key----------------------------
    //社区资讯评论的总数量 key=community_comment_count:{communityId} value = 评论的数量
    public static final String COMMUNITY_COMMENT_COUNT="community_comment_count:";
    //------------------回复的key----------------------------
    //社区资讯回复点赞的人员集合的key value = 该回复的[userId]
    public static final String TWO_LIKE ="two_like:";
    //对应用户点赞的回复key=two_my_like:{用户id} value = [评论id]
    public static final String TWO_MY_LIKE ="two_my_like:";
    //社区资讯评论点赞的数量 给数据库同步数据在 redis中增加一个有过期时间的key key=two_like_count_time:{评论id}#{数量} 过期时候value获取不到
    public static final String TWO_LIKE_COUNT_TIME ="two_like_count_time:";
    //社区资讯评论点赞的数量永久key key=two_like_count:{评论id} value = 该评论的点赞数量
    public static final String TWO_LIKE_COUNT="two_like_count:";

    //-------------------社区资讯收藏的key-----------------
    //社区资讯收藏的人员集合的key = stars_community:{communityId} value = 该资讯收藏的[userId]
    public static final String STARS_COMMUNITY ="stars_community:";
    //社区资讯收藏的总数的key = stars_user_count:{communityId} value = 收藏的人数值
    public static final String STARS_USER_COUNT ="stars_user_count:";

    //-------------------党建资讯收藏的key-----------------
    //党建资讯收藏的人员集合的key = stars_party_news:{userId} value = 该用户收藏的党建[partyId]
    public static final String STARS_PARTY_NEWS ="stars_party_news:";
    //党建资讯对应资讯收藏的数量key =stars_party_news_count:{partyId} value = 收藏的数量
    public static final String STARS_PARTY_NEWS_COUNT ="stars_party_news_count:";

    //-------------------未读互动的key-----------------
    //记录社区资讯某个用户一共有多少个未读的互动(点赞，收藏，回复)的具体信息，记录成map形式{} key = comment_interaction_user:{userId} hkey = {targetType:targetId} value= CommentInteractionVo
    public static final String COMMENT_INTERACTION_USER ="comment_interaction_user:";
    //记录社区资讯某个用户一共有多少个未读的互动的数量key = comment_interaction_user_count:{userId} value = 未读的互动的数量
    public static final String COMMENT_INTERACTION_USER_COUNT ="comment_interaction_user_count:";
    //记录社区资讯某个用户对应资讯下有多少个未读的互动key=comment_interaction_community_user_count:{userId} hkey = {community_id} value = 资讯下有多少个未读的互动(点赞，收藏，回复)
    public static final String COMMENT_INTERACTION_COMMUNITY_USER_COUNT ="comment_interaction_community_user_count:";

}
