import { Participant } from './participant';
import { Stream } from './stream';

export enum CharacterMode {
  TEXT = 'text',
  CO_PILOT = 'co_pilot',
  AUTO_PILOT = 'auto_pilot',
  VISION_PILOT = 'vision_pilot'
}

export enum CharacterState {
  CHARACTER_SPEAKING = 'CHARACTER_SPEAKING',
  CHARACTER_THINKING = 'CHARACTER_THINKING',
  CHARACTER_LISTENING = 'CHARACTER_LISTENING'
}

export class Character extends Participant {
  /**
   * @description This represents interactionId of interaction
   */
  interactionId: string;

  /**
   * @description This represents the id character participant
   */
  id: string;

  /**
   * @description This represents state of character participant
   */
  state: CharacterState;

  /**
   * @description This represents attached knowledge to character participant
   */
  knowledgeBases: string[];

  /**
   * @description This represents language of interaction
   */
  language: string;

  /**
   * @description This represents communication mode of character participant
   */
  characterMode: CharacterMode;

  /**
   * @description This represents role of character participant
   */
  characterRole: string;

  /**
   * @description This method can be used to join a character participant in the meeting
   */
  join(): Promise<void>;

  /**
   * @description This method can be used to leave a character participant from the meeting
   */
  leave(): Promise<void>;

  /**
   * @description This method can be used to send message to a character participant
   */
  sendMessage(text: string): Promise<void>;

  /**
   * @description This method can be used to interrupt a character participant
   */
  interrupt(): Promise<void>;

  /**
   * Add event listener
   * @param eventType Event name to which you want to subscribe.
   * @param listener Callback function which will be triggered when the event happens
   */
  on(
    eventType:
      | 'stream-enabled'
      | 'stream-disabled'
      | 'media-status-changed'
      | 'video-quality-changed'
      | 'character-state-changed'
      | 'character-message'
      | 'character-joined'
      | 'character-left'
      | 'user-message'
      | 'data',
    listener: (data: any) => void
  ): void;
  /**
   * Remove event
   * @param eventType Event name to which you want to unsubscribe.
   * @param listener Callback function which was passed while subscribing to the event
   */
  off(
    eventType:
      | 'stream-enabled'
      | 'stream-disabled'
      | 'media-status-changed'
      | 'video-quality-changed'
      | 'character-state-changed'
      | 'character-message'
      | 'character-joined'
      | 'character-left'
      | 'user-message'
      | 'data',
    listener: (data: any) => void
  ): void;
}
