import { EventJsonDecoder } from './event-json';

export interface RenameRoomEventJson {
  requester?: string;
  roomName?: string;
}

export const decodeRenameRoomEventJson: EventJsonDecoder<
  RenameRoomEventJson
> = (message: string) => {
  return {
    requester: message.substring(0, message.indexOf(',')),
    roomName: message.substring(message.indexOf(',') + 1)
  } as RenameRoomEventJson;
};
