export interface MJMessage {
  uri: string;
  proxy_url?: string;
  content: string;
  flags: number;
  id?: string;
  hash?: string;
  progress?: string;
  options?: MJOptions[];
  width?: number;
  height?: number;
}

export type MJMessageProgress = Pick<MJMessage, 'uri' | 'progress' | 'options' | 'hash'>;
export type LoadingHandler = (progress: MJMessageProgress) => void;
export type OnModal = (nonce: string, id: string, custom_id?: string, prompt_custom_id?: string) => Promise<string>;

export interface WaitMjEvent {
  nonce: string;
  prompt?: string;
  hash?: string;
  id?: string;
  del?: boolean; // is delete message
  onmodal?: OnModal;
}
export interface MJEmit {
  error?: Error;
  message?: MJMessage;
}

export interface MJInfo {
  subscription: string;
  jobMode: string;
  visibilityMode: string;
  fastTimeRemaining: string;
  lifetimeUsage: string;
  relaxedUsage: string;
  queuedJobsFast: string;
  queuedJobsRelax: string;
  runningJobs: string;
  message?: string;
}

export interface MJSubscribe {
  url: string;
  label: string;
  type: number;
}

export interface MJOptions {
  label: string;
  type: number;
  style: number;
  custom: string;
}
export interface MJSettings {
  content: string;
  id: string;
  flags: number;
  options: MJOptions[];
}
export interface MJIframe {
  id: string;
  nonce: string;
  modal_size: number;
  iframe_path: string;
  custom_id: string;
}
export interface MJDescribe {
  id: string;
  flags: number;
  uri: string;
  proxy_url?: string;
  options: MJOptions[];
  descriptions: string[];
}

export interface MJShorten {
  description: string;
  id: string;
  flags: number;
  options: MJOptions[];
  prompts: string[];
}

export interface QueueItem {
  request: any;
  callback: (any: any) => void;
}
