export type ActionType = 'request' | 'accept' | 'decline' | 'cancel';

export interface Message {
  type:
    | 'make_move'
    | 'resign'
    | 'takeback'
    | 'draw'
    | 'rematch'
    | 'redirect_to_game'
    | 'update_display_name';
}

export interface UpdateDisplayNameMessage extends Message {
  displayName: string;
}

export interface MakeMoveMessage extends Message {
  row: number;
  col: number;
}

export interface ResignationMessage extends Message {}

export interface TakebackMessage extends Message {
  action: ActionType;
}

export interface DrawMessage extends Message {
  action: ActionType;
}

export interface RematchMessage extends Message {
  action: ActionType;
}

export interface RedirectToGameMessage extends Message {
  gameId: string;
}
