namespace JiaZhiQuan.Common
{
    public static partial class CacheKeys
    {

        /// <summary>
        /// 用户签到记录缓存
        /// </summary>
        public static string UserSign(long userId)
        {
            return GenerateKey($"sign:{userId}");
        }

        /// <summary>
        /// 用于缓存用户登录记录，以天为单位，值类型为 UserStateCacheModel{id, state, date}
        /// </summary>
        public static string UserState(string userId)
        {
            return GenerateKey($"user_state:{userId}");
        }

        public const int UserStateValueCacheSecs = 60 * 1; // 一分钟
        /// <summary>
        /// 暂时用于验证用户是否已注销，值为 State 值。如果用户不存在，则为-1
        /// </summary>
        public static string UserStateValue(long userId)
        {
            return GenerateKey($"user_state_val:{userId}");
        }

        public const int UserTokenCacheSecs = 30 * 24 * 60 * 60;

        public static string UserToken(string userId, string from)
        {
            return GenerateKey($"user_token:{userId}:{from ?? "default"}");
        }


        public static string WeixinLoginBackUrlCache(string guid)
        {
            return GenerateKey($"wx_login:{guid}");
        }

        public static string UserInitTags()
        {
            return GenerateKey("user_init_tags");
        }

        public const int UserPrivacySettingCacheSecs = 60;

        public static string UserPrivacySetting(string userId)
        {
            return GenerateKey($"user_privacy_setting:{userId}");
        }

        public static string UserPrivacySetting(long userId)
        {
            return GenerateKey($"user_privacy_setting:{userId}");
        }

        public const int UserTagsCacheSecs = 60 * 10; // 10分钟
        public static string UserTags(long userId)
        {
            return GenerateKey($"user_tags:{userId}");
        }


        /// <summary>
        /// 用户邀请预警邮件提醒，一个小时内最多发一次提醒邮件
        /// </summary>
        public const int UserInvitationWarningCacheSecs = 60 * 60;

        public static string UserInvitationWarningCache()
        {
            return GenerateKey("user_invite:warning");
        }

        /// <summary>
        /// 用户邀请，同一用户一小时内只提示一次
        /// </summary>
        public const int UserInvitationWarningRecordCacheSecs = 60 * 60;

        public static string UserInvitationWarningRecordCache(long userId)
        {
            return GenerateKey($"user_invite:warning:{userId}");
        }

        /// <summary>
        /// 关注推荐用户列表过期时间，24x小时20分钟
        /// </summary>
        public const int FocusAndRecommendUserIdsCacheSecs = 60 * 60 * 24 + 60 * 20;
        /// <summary>
        /// 关注推荐用户列表
        /// </summary>
        public static string FocusAndRecommendUserIds()
        {
            return GenerateKey("focus_recommend_userids");
        }

        /// <summary>
        /// 关注推荐用户列表用户游标过期时间，24小时
        /// </summary>
        public const int FocusUserCursorCacheSecs = 60 * 60 * 24;
        /// <summary>
        /// 关注推荐用户列表用户游标
        /// </summary>
        public static string FocusUserCursor(string userId)
        {
            return GenerateKey("focususer_cursor:" + userId);
        }

        /// <summary>
        /// 关注推荐用户列表V2过期时间，24x小时20分钟
        /// </summary>
        public const int FocusAndRecommendPostIdsCacheSecs = 60 * 60 * 24 + 60 * 20;
        /// <summary>
        /// 关注推荐用户列表Vw
        /// </summary>
        public static string FocusAndRecommendPostIds()
        {
            return GenerateKey("focus_recommend_postids");
        }
    }
}
