import {
  CharacterPacket,
  CompositePacket,
  FullStatePacket,
  PositionUpdatePacket,
} from './packet';
import { IcyNetUser } from './user';

export interface ServerToClientEvents {
  'set.me': (player: CompositePacket | null) => void;
  'error.duplicate': () => void;
  'player.list': (players: Partial<CompositePacket>[]) => void;
  'player.chat': (data: {
    sender: Partial<IcyNetUser>;
    message: string;
  }) => void;
  'player.join': (player: IcyNetUser) => void;
  'player.leave': (player: Partial<IcyNetUser>) => void;
  'player.update': (packet: Partial<PositionUpdatePacket[]>) => void;
  'player.character': (packet: CharacterPacket & { id: number }) => void;
}

export interface ClientToServerEvents {
  'set.chat': (message: string) => void;
  'set.character': (packet: CharacterPacket) => void;
  'set.move': (packet: FullStatePacket) => void;
}
