import type { Dispatch, SetStateAction } from 'react';

export type StateSetter<T> = Dispatch<SetStateAction<T>>;

export type UserCountMessage = {
  type: 'users';
  count: number;
};

export type WelcomeMessage = {
  type: 'welcome';
  id: string;
};

export type BroadcastMessage = {
  type: string;
  count?: number;
  id?: string;
};

export type WebSocketMessage = UserCountMessage | WelcomeMessage | Record<string, unknown>;
