/*! arqamExplain — TypeScript declarations for dist/arqamExplain.mjs. MIT licence.
 *  Copied to dist/ by tools/build_dist.py; tests/dist.test.js checks that every export of the module is declared here
 *  and that the declarations compile. The module imports the engine (arqamAR.mjs) and attaches arqamAR.explain. 
 *  @author: Mohsen Alyafei */
import type { ArqamNumber, ArqamOptions, ArqamDate, ArqamDateOptions, ArqamTime, ArqamTimeOptions, ArqamFraction, ArqamFractionOptions, ArqamNumberFormatOptions } from "./arqamAR.mjs";

/** What a word is in the text. "word" is any other word (فقط، سالب، بالمائة، لا غير …). */
export type ArqamExplainPart = "number" | "scale" | "noun" | "adjective" | "qualifier" | "idafa" | "separator" | "word" | "approx";

/** One word of the text, with its grammar. */
export interface ArqamExplainWord {
  /** the word as written (with the tashkeel asked for) */
  word: string;
  /** the word without marks (أ إ آ written ا) */
  plain: string;
  part: ArqamExplainPart;
  /** the value of a number word (ثلاثة -> 3), when it has one */
  value?: number;
  /** the case in one line (the «مختصر» level) */
  short: string;
  /** the reason for the form (the «مفصّل» level) */
  why: string;
  /** the ids of the rules used, keys of ArqamExplanation.rules */
  rules: string[];
  /** up to three comparisons: [the same word in another count, gender or case, a note] */
  compare: [string, string][];
}

/** A rule of the grammar. */
export interface ArqamExplainRule {
  title: string;
  text: string;
  example: string;
}

/** The result of explain() and explainDate(). An input that gives no words gives text "" and empty lists. */
export interface ArqamExplanation {
  /** the same text as toWords() / toDate() with these options (no colour markers) */
  text: string;
  words: ArqamExplainWord[];
  /** the rules used, by id */
  rules: Record<string, ArqamExplainRule>;
  /** the rule ids in order of first use */
  order: string[];
}

/** The script's function: arqamExplain(number, options) and arqamExplain.date(input, options). */
export interface ArqamExplain {
  (number: ArqamNumber, options?: ArqamOptions): ArqamExplanation;
  /** A list gives one explanation per item, as toWords(list) gives one text per item. */
  (numbers: ArqamNumber[], options?: ArqamOptions): ArqamExplanation[];
  /** The words of toDate(), word by word. */
  date(input: ArqamDate, options?: ArqamDateOptions): ArqamExplanation;
  /** The words of toTime(), word by word. */
  time(input: ArqamTime, options?: ArqamTimeOptions): ArqamExplanation;
  /** The words of toFraction(), word by word. */
  fraction(input: ArqamFraction, options?: ArqamFractionOptions): ArqamExplanation;
  /** The words of NumberFormat(options).formatRange(from, to), word by word; options as NumberFormat's. */
  range(from: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate, to: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate, options?: ArqamNumberFormatOptions): ArqamExplanation;
  /** Every rule the library knows, by id. */
  readonly rules: Record<string, ArqamExplainRule>;
  readonly version: string;
}

declare const arqamExplain: ArqamExplain;
export default arqamExplain;
export declare const version: string;
export declare const rules: Record<string, ArqamExplainRule>;
/** The grammar of the words of toWords(number, options), word by word. Options as for toWords(). */
export declare function explain(number: ArqamNumber, options?: ArqamOptions): ArqamExplanation;
/** A list gives one explanation per item. */
export declare function explain(numbers: ArqamNumber[], options?: ArqamOptions): ArqamExplanation[];
/** The grammar of the words of toDate(input, options), word by word. */
export declare function explainDate(input: ArqamDate, options?: ArqamDateOptions): ArqamExplanation;
/** The grammar of the words of toTime(input, options), word by word. */
export declare function explainTime(input: ArqamTime, options?: ArqamTimeOptions): ArqamExplanation;
/** The grammar of the words of toFraction(input, options), word by word. */
export declare function explainFraction(input: ArqamFraction, options?: ArqamFractionOptions): ArqamExplanation;
/** The grammar of the words of NumberFormat(options).formatRange(from, to), word by word. */
export declare function explainRange(from: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate, to: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate, options?: ArqamNumberFormatOptions): ArqamExplanation;
