import { WebSocket } from 'ws';

export interface ConnectedUser {
  oderId: string;
  ws: WebSocket;
  serverIds: Set<string>;
  viewedServerId?: string;
  displayName?: string;
  description?: string;
  profileUpdatedAt?: number;
  /**
   * Opaque scope string sent by the client (typically the signal URL it
   * connected through).  Stale-connection eviction only targets connections
   * that share the same (oderId, connectionScope) pair, so multiple signal
   * URLs routing to the same server coexist without an eviction loop.
   */
  connectionScope?: string;
  /** User availability status (online, away, busy, offline). */
  status?: 'online' | 'away' | 'busy' | 'offline';
  /** Latest server icon timestamp this connection can provide over P2P. */
  serverIconUpdatedAtByServerId?: Map<string, number>;
  /** Timestamp of the last pong or client message received (used to detect dead connections). */
  lastPong: number;
}
