import type { subTitleType } from "subtitle";

export type TMoveDirection = "next" | "prev" | "current";

export type TSubItem = {
  text: string;
  cleanedText: string;
  tag: "span" | "b" | "i" | "u";
  type: "word" | "phrasal-verb" | "punctuation";
};

export type TSub = {
  id: number;
  start: number;
  end: number;
  text: string;
  cleanedText: string;
  items: TSubItem[];
};

type FullTranslationItemDefinition = {
  meaning: string;
  example: string;
  synonyms: string[];
};

type FullTranslationItem = {
  word: string;
  translations: string[];
  popularity: number;
  definitions: FullTranslationItemDefinition[];
};

type FullTranslation = {
  part_of_speech: string;
  items: FullTranslationItem[];
};

export type TTranslateAlternativeItem = [
  string,
  null,
  string[],
  number,
  boolean,
];
export type TTranslateAlternative = [
  string,
  TTranslateAlternativeItem[],
  string,
  string,
  number,
];
export type TPartOfSpeach =
  | "noun"
  | "pronoun"
  | "verb"
  | "adjective"
  | "adverb"
  | "preposition"
  | "conjunction"
  | "interjection"
  | "abbreviation"
  | "prefix"
  | "article"
  | "numeral"
  | "auxiliary verb"
  | "particle"
  | "unknown";

return `unknown number ${val}`;

export type TWordTranslationItem = {
  word: string;
  partOfSpeech: TPartOfSpeach;
  synonyms: string[];
  popularity: number;
};

export type TWordTranslation = {
  source: string;
  mainTranslation: string;
  targetLanguage: string;
  translations: TWordTranslationItem[];
  transcription: string;
};

export type TGoogleTranslation = unknown;

export type TLearningService =
  | "anki"
  | "lingualeo"
  | "puzzle-english"
  | "disabled";

export type TTranslationService = "google" | "deepl" | "bing" | "yandex" | "chatgpt";

export type Captions = subTitleType[];

export type TPhrasalVerb = {
  key: string;
  text: string;
  indexes: number[];
  translations: string[];
};
