import {ChatEventType} from './models/eventBase';

export interface NewMessageSocketEvent {
  /**
   * ULID timestamp
   */
  ts: string;
  /**
   * Event type
   */
  type: ChatEventType;
  instance: number;
  /**
   * User id which triggered the event
   */
  initiaror: string;
  msg_text: string;
  /**
   * User id of the message sender
   */
  msg_sender_id: string;
  /**
   * ULID timestamp of the message
   */
  msg_ts: string;
  msg_client_msg_id: string;
  /**
   * Channel ULID timestamp
   */
  channel_ts: string;
  /**
   * Channel ULID lastest message id
   */
  channel_last_msg_id: string;

  msg_sender_fullname: string;
  msg_sender_picture?: string;
  msg_version: number;
  channel_version: number;
  json_event: string;
}

export interface ReadChatEvent {
  /**
   * ULID timestamp
   */
  ts: string;
  /**
   * Event type
   */
  type: ChatEventType;
  instance: number;
  initiator: number;
  /**
   * Channel ULID timestamp
   */
  channel_ts: string;
  /**
   * Channel ULID lastest message
   */
  channel_last_msg_id: string;
  channel_is_im: true;
  json_event: string;
}

export interface JoinedChatEvent {
  /**
   * ULID timestamp
   */
  ts: string;
  /**
   * Event type
   */
  type: ChatEventType;
  instance: number;
  initiator: number;
  /**
   * Channel ULID timestamp
   */
  channel_ts: string;
  channel_is_im: boolean;
  channel_version: number;
  json_event: string;
}

export interface NewChannelEvent {
  ts: string;
  type: ChatEventType;
  instance: number;
  initiator: number;
  json_event: string;
  channel_ts: string;
  channel_is_im: boolean;
  channel_version: number;
}

export interface AdminAddedEventSocket {
  ts: string;
  type: string;
  instance: number;
  initiator: number;
  data: string;
  json_event: string;
  channel_ts: string;
  channel_last_msg_id: string;
  channel_is_im: boolean;
  channel_version: number;
}

export interface AdminRemovedEventSocket {
  ts: string;
  type: string;
  instance: number;
  initiator: number;
  data: string;
  json_event: string;
  channel_ts: string;
  channel_last_msg_id: string;
  channel_is_im: boolean;
  channel_version: number;
}

export interface ChannelChangedEventSocket {
  ts: string;
  type: string;
  instance: number;
  initiator: number;
  data: string;
  json_event: string;
  channel_ts: string;
  channel_last_msg_id: string;
  channel_is_im: boolean;
  channel_version: number;
}
export interface JsonEventSocket {
  json_event: string;
}

export interface MarkedReadEventSocket {
  ts: string;
  type: string;
  instance: number;
  initiator: number;
  data: string;
  json_event: string;
  channel_ts: string;
  channel_last_msg_id: string;
  channel_is_im: boolean;
  channel_version: number | null;
  msg_text: string;
  msg_sender_id: number;
  msg_ts: string;
  msg_client_msg_id: string;
  msg_position: number;
  msg_version: number | null;
  msg_sender_fullname: string;
  msg_sender_picture: string;
}

export interface LeftChatEvent extends JoinedChatEvent {}
