// Shared constants for ChatApp

export const WS_EVENTS = {
  MESSAGE: 'message',
  MESSAGE_CHANGED: 'message_changed',
  MESSAGE_DELETED: 'message_deleted',
  REACTION_ADDED: 'reaction_added',
  REACTION_REMOVED: 'reaction_removed',
  CHANNEL_JOIN: 'channel_join',
  CHANNEL_LEAVE: 'channel_leave',
  CHANNEL_CREATED: 'channel_created',
  USER_TYPING: 'user_typing',
  PRESENCE_CHANGE: 'presence_change',
  HUDDLE_START: 'huddle_start',
  HUDDLE_END: 'huddle_end',
} as const;

export const REDIS_KEYS = {
  PRESENCE: (userId: string) => `presence:${userId}`,
  TYPING: (channelId: string, userId: string) => `typing:${channelId}:${userId}`,
  UNREAD: (userId: string, channelId: string) => `unread:${userId}:${channelId}`,
  CACHE_USER: (userId: string) => `cache:user:${userId}`,
  CACHE_CHANNEL: (channelId: string) => `cache:channel:${channelId}`,
  CACHE_WORKSPACE: (wsId: string) => `cache:workspace:${wsId}`,
} as const;

export const RATE_LIMITS = {
  API_PER_MINUTE: 100,
  WS_MESSAGES_PER_MINUTE: 30,
  AUTH_LOGIN_PER_MINUTE: 5,
} as const;
