export enum ChatEventType {
  /**
   * New message event
   */
  message = 'message',
  /**
   * Message updated event
   */
  messageUpdate = 'message_update',
  /**
   * Message deleted event
   */
  messageDeleted = 'message_deleted',
  /**
   * Message reaction event
   */
  messageReaction = 'message_reaction',
  /**
   * 1o1 conversation created
   */
  imCreated = 'im_created',
  /**
   * Group conversation created
   */
  channelCreated = 'channel_created',

  /**
   * User opened the conversation. This event is used to update the unread count
   */
  channelMarked = 'channel_marked',

  channelJoined = 'channel_joined',
  channelLeft = 'channel_left',

  channelAdminGranted = 'channel_admin_granted',
  channelAdminRevoked = 'channel_admin_revoked',

  channelChanged = 'channel_changed',

  attachmentChanged = 'attachment_changed',

  markedReceived = 'marked_received',
  markedRead = 'marked_read',
  channelInfoChanged = 'channel_info_changed',
  messagePin = 'message_pin',
  messageReadByAll = 'message_read_by_all',
}

export enum ChatEventSubtype {
  meMessage = 'me_message',
  channelLeft = 'channel_left',
  channelJoined = 'channel_joined',
  channelCreated = 'channel_created',
  channelChanged = 'channel_changed',
  callInitialized = 'call_initialized',
  callEnded = 'call_ended',
  messageUpdate = 'message_update',
  messageDelete = 'message_deleted',
  add = 'add',
  remove = 'remove',
  markedReceived = 'marked_received',
  markedRead = 'marked_read',
  adminKicks = 'admin_kicks',
  userDeactivation = 'user_deactivation',
  userDeletion = 'user_deletion',
  userLeft = 'user_left',
  messagePinAdded = 'message_pin_added',
  messageReadByAll = 'message_read_by_all',
}

export interface ChatEventBase<T extends ChatEventType, S = undefined> {
  /**
   * Event type
   */
  type: T;
  /**
   * Event subtype
   */
  subtype?: S;
  channel: string;
  user: string;
  username: string;
  ts: string;
  external_id: string;
  hu_data: {
    version: number;
    position: number;
  };
}
