// Shared configuration values

export const CONFIG = {
  // Voting
  MAX_VOTES_PER_USER: 7,
  VOTE_CATEGORIES_COUNT: 7,

  // WebSocket
  HEARTBEAT_INTERVAL_MS: 5000,
  HEARTBEAT_TIMEOUT_MS: 10000,
  RECONNECTION_DELAY_MS: 1000,
  RECONNECTION_DELAY_MAX_MS: 5000,
  RECONNECTION_ATTEMPTS: Infinity,

  // Rate limiting
  RATE_LIMIT_WINDOW_MS: 1000,
  RATE_LIMIT_MAX_REQUESTS: 10,

  // Session
  SESSION_TTL_SECONDS: 3600, // 1 hour

  // Queue
  VOTE_QUEUE_MAX_RETRIES: 3,
  VOTE_QUEUE_RETRY_DELAY_MS: 1000,

  // Sync
  SYNC_BATCH_SIZE: 100,
  SYNC_INTERVAL_MS: 1000,
} as const;

export const REDIS_KEYS = {
  // Vote counting
  VOTE_COUNT: 'vote:count', // vote:count:{category}
  USER_CATEGORIES: 'vote:user', // vote:user:{userId}:categories
  CATEGORY_VOTERS: 'vote:category', // vote:category:{category}:voters
  LEADERBOARD: 'leaderboard', // leaderboard:{category}

  // Locking
  VOTE_LOCK: 'lock:vote', // lock:vote:{userId}:{category}

  // Sync
  SYNC_QUEUE: 'sync:queue:votes',
  SYNC_PROCESSING: 'sync:processing',

  // Session
  SESSION: 'session', // session:{sessionId}
  USER_SESSION: 'session:user', // session:user:{userId}

  // Rate limiting
  RATE_LIMIT: 'ratelimit:vote', // ratelimit:vote:{userId}

  // Draw
  DRAW_ACTIVE: 'draw:active',
  DRAW_PARTICIPANTS: 'draw:participants',
  DRAW_WINNERS: 'draw:winners',
} as const;
