package com.haha.common.constant;

/**
 * Redis键常量类
 * 统一管理所有Redis缓存键名
 */
public final class RedisConstants {
    
    private RedisConstants() {}
    
    // ==================== Sa-Token 相关 ====================
    
    /** Sa-Token 用户Token键前缀 */
    public static final String SA_TOKEN_USER_TOKEN_KEY = "sa:token:%s";
    
    /** Sa-Token 用户登录ID键前缀 */
    public static final String SA_TOKEN_USER_LOGIN_ID_KEY = "sa:loginid:%s";
    
    /** Sa-Token 用户会话键前缀 */
    public static final String SA_TOKEN_USER_KEY_PREFIX = "satoken:user:";
    
    // ==================== 设备状态相关 ====================
    
    /** 设备状态键前缀（带格式化占位符） */
    public static final String DEVICE_STATUS_KEY = "device:status:%s";
    
    /** 设备状态键前缀（haha平台回调格式） */
    public static final String HAHA_DEVICE_STATUS_KEY = "haha:device:status:";
    
    /** 设备信息缓存键 */
    public static final String DEVICE_INFO_KEY = "device:info:%s";
    
    /** 设备信息缓存键前缀 */
    public static final String DEVICE_INFO_KEY_PREFIX = "device:info:";
    
    // ==================== 设备同步相关 ====================

    /** 设备同步防抖键前缀，参数：设备ID */
    public static final String DEVICE_SYNC_DEBOUNCE = "device:sync:debounce:";

    // ==================== 设备告警相关 ====================
    
    /** 设备告警冷却键前缀，参数：设备ID、告警类型 */
    public static final String DEVICE_ALERT_COOLDOWN_KEY = "device:alert:cooldown:%s:%s";
    
    /** 设备最后在线时间键前缀，参数：设备ID */
    public static final String DEVICE_LAST_ONLINE_KEY = "device:last:online:%s";
    
    // ==================== 识别结果相关 ====================
    
    /** AI识别结果键前缀 */
    public static final String HAHA_RECOGNIZE_RESULT_KEY = "haha:recognize:result:";
    
    // ==================== 订单信息相关 ====================
    
    /** 订单信息键前缀（haha平台回调格式） */
    public static final String HAHA_ORDER_INFO_KEY = "haha:order:info:";
    
    /** 临时订单键前缀 */
    public static final String ORDER_TEMP_KEY = "order:temp:%s";
    public static final String ORDER_TEMP_KEY_PREFIX = "order:temp:";
    
    // ==================== 用户信息相关 ====================
    
    /** 用户信息缓存键 */
    public static final String USER_INFO_KEY = "user:info:%s";
    public static final String USER_INFO_KEY_PREFIX = "user:info:";
    
    // ==================== 商品信息相关 ====================
    
    /** 商品信息缓存键 */
    public static final String PRODUCT_INFO_KEY = "product:info:%s";
    public static final String PRODUCT_INFO_KEY_PREFIX = "product:info:";
    
    // ==================== 分布式锁相关 ====================
    
    /** 开门分布式锁键前缀 */
    public static final String LOCK_DOOR_KEY = "lock:door:%s";
    public static final String LOCK_DOOR_KEY_PREFIX = "lock:door:";

    // ==================== 补货员绑定相关 ====================

    /** 补货员绑定码Redis键前缀 */
    public static final String REPLENISHER_BIND_CODE_KEY = "replenisher:bind:code:%s";

    /** 补货员绑定码Redis键前缀（无占位符） */
    public static final String REPLENISHER_BIND_CODE_KEY_PREFIX = "replenisher:bind:code:";
}
