package com.zhentao.constant;

/**
 * Redis缓存Key常量
 */
public class RedisKeyConstants {
    
    /**
     * 红娘详情缓存Key前缀
     * 格式：matchmaker:detail:{matchmakerId}
     */
    public static final String MATCHMAKER_DETAIL = "matchmaker:detail:";
    
    /**
     * 红娘列表缓存Key前缀
     * 格式：matchmaker:list:{type}:{level}:{provinceId}:{cityId}:{pageNum}:{pageSize}
     */
    public static final String MATCHMAKER_LIST = "matchmaker:list:";
    
    /**
     * 全职红娘列表缓存Key前缀
     * 格式：matchmaker:formal:{pageNum}:{pageSize}
     */
    public static final String MATCHMAKER_FORMAL_LIST = "matchmaker:formal:";
    
    /**
     * 热门红娘列表缓存Key
     */
    public static final String MATCHMAKER_HOT_LIST = "matchmaker:hot:list";
    
    /**
     * 红娘详情缓存过期时间（秒）- 1小时
     */
    public static final long MATCHMAKER_DETAIL_EXPIRE = 3600;
    
    /**
     * 红娘列表缓存过期时间（秒）- 30分钟
     */
    public static final long MATCHMAKER_LIST_EXPIRE = 1800;
    
    /**
     * 热门红娘列表缓存过期时间（秒）- 30分钟
     */
    public static final long MATCHMAKER_HOT_EXPIRE = 1800;
    
    /**
     * 构建红娘详情缓存Key
     */
    public static String buildMatchmakerDetailKey(Integer matchmakerId) {
        return MATCHMAKER_DETAIL + matchmakerId;
    }
    
    /**
     * 构建红娘列表缓存Key
     */
    public static String buildMatchmakerListKey(Integer type, Integer level, Integer provinceId, 
                                                 Integer cityId, Integer pageNum, Integer pageSize) {
        return MATCHMAKER_LIST + 
               (type != null ? type : "all") + ":" +
               (level != null ? level : "all") + ":" +
               (provinceId != null ? provinceId : "all") + ":" +
               (cityId != null ? cityId : "all") + ":" +
               pageNum + ":" + pageSize;
    }
    
    /**
     * 构建全职红娘列表缓存Key
     */
    public static String buildFormalListKey(Integer pageNum, Integer pageSize) {
        return MATCHMAKER_FORMAL_LIST + pageNum + ":" + pageSize;
    }
}

