import { Participant } from "./participant";

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 the character participant's ID
   */
  id: string;
  /**
   * @description This represents the character participant's name
   */
  displayName: string;

  /**
   * @description This represents the id of running interaction
   */
  interactionId: string;
  /**
   * @description This represents the character participant's role
   */
  characterRole: string;
  /**
   * @description This represents the mode of character participant
   */
  characterMode: CharacterMode;
  /**
   * @description This represents the current state of character participant
   */
  state: CharacterState;
  /**
   * @description This represents the Array of knowledge bases associated with the character participant
   */
  knowledgeBases: Array<string>;
  /**
   * @description This represents the language of interaction
   */
  language: string;

  /**
   * @description This method can be used to join a character participant in the meeting
   */
  join(): void;
  /**
   * @description This method can be used to leave a character participant from the meeting
   */
  leave(): void;
  /**
   * @description Send Message(ask query) to character participant
   */
  sendMessage(text: string): Promise<void>;

  /**
   * @description Interrupts character while speaking
   */
  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;
}
