// TypeScript declarations of the English engine arqamEN: English numbers and amounts in words.
//   import arqamEN from "arqam/en";
//   arqamEN.toWords("1250.50", "QAR")   // One Thousand Two Hundred Fifty Qatari Riyals and Fifty Dirhams
// @author : Mohsen Alyafei
export type ArqamENNumber = string | number | bigint;
export type ArqamENSwitch = "on" | "off" | "";
export interface ArqamENOptions {
  /** "" numbers (default), "currency" or "c" an amount, "ordinals" or "o" ordinals */
  mode?: "" | "currency" | "c" | "ordinals" | "o";
  /** The ISO code of the currency: "QAR", "USD" … (the name Intl gives it) */
  currency?: string;
  /** "end" (default) or "start": the currency after or before the number */
  currencyPos?: "" | "start" | "end";
  /** "on" drops the country adjective: "Dollar" not "US Dollar" */
  noCountry?: ArqamENSwitch;
  /** The country adjective, major and minor names of a currency given in the call */
  demonym?: string; major?: string; majorPl?: string; minor?: string; minorPl?: string;
  /** "uk" writes "and" before the tens and units (One Hundred and One); "" US (default) */
  style?: "" | "us" | "uk";
  /** "on" puts a comma between the scale groups */
  comma?: ArqamENSwitch;
  /** The figure in brackets: "start", "end", or "" none */
  brackets?: "" | "start" | "end";
  /** The label in the brackets: "" the ISO code, "c" adjective and major name, "i" ISO code, "l" Latin symbol,
   *  "n" native symbol, or any other text as given */
  symbol?: string;
  /** "U" upper case, "L" lower case, "S" sentence case, "" title case (default) */
  textFormat?: "" | "U" | "L" | "S";
  /** Decimal places kept; "" the currency's places (2 if unknown) or 10 for numbers */
  decRound?: number | string;
  /** The form of the fraction: "" point digits, "w" point words, "n" point figure, "." and 0.12, "/" and 12/100,
   *  "th" and twelve hundredths, "tn" and 12 hundredths, "p" parts of one hundred, "pn", "nn" */
  decFormat?: string;
  /** decFormat for amounts only */
  decFormatC?: string;
  /** decFormat for numbers only */
  decFormatN?: string;
  /** The word before the fraction */
  decWord?: string;
  /** "on" writes the groups as figures: "12 Million 123 Thousand 1" */
  compact?: ArqamENSwitch;
  /** The word for a negative number (default "Negative") */
  negativeWord?: string;
  /** The separators of the figure in brackets */
  sepDecimal?: string; sepThousands?: string;
  /** "on" rounds extra decimal digits (half up); "" or "off" cuts them */
  rounding?: ArqamENSwitch;
  /** Returned when the input is not a number */
  isNaN?: string;
  /** "on" writes the fraction as given (no padding, trailing zeros dropped) */
  openDecimals?: ArqamENSwitch;
  /** "end" writes "Only" after the words, "start" before them */
  only?: "" | "start" | "end";
  /** "on" puts colour markers in the words (|p…| |c…| |f| and "|" between groups) */
  split?: ArqamENSwitch;
  /** "indian" counts in lakh and crore (One Lakh Twenty-Three Thousand); "" or "short": thousand, million … */
  scale?: "" | "short" | "indian";
}
/** The attributes of a currency given to registerCurrency() */
export interface ArqamENCurrencyAttributes {
  demonym?: string; major?: string; majorPl?: string; minor?: string; minorPl?: string;
  symbolLatin?: string; symbolNative?: string;
  /** The places of the minor unit (default 2) */
  decimals?: number | string;
  /** Decimals written as given (crypto) */
  openDecimals?: boolean | string;
}
/** A row of the currency table: [demonym, major, majorPl, symbolLatin, symbolNative, minor, minorPl, decimals, openDecimals] */
export type ArqamENCurrencyRow = (string | number | null | undefined)[];
/** Options of arqamEN.NumberFormat: Intl's names, variant and scale, and every toWords option but style (Intl's here).
 *  When an Intl name and an Arqam name are both given, Arqam's wins (mode, symbol). Unknown names are a TypeError;
 *  Intl's options for figures (useGrouping, notation, minimumFractionDigits …) a RangeError. */
export interface ArqamENNumberFormatOptions extends Omit<ArqamENOptions, "style" | "textFormat"> {
  /** "decimal" (default) · "currency" · "percent" (the number times 100, as Intl) · "ordinal" (Arqam's own) */
  style?: "decimal" | "currency" | "percent" | "ordinal";
  /** style "currency": an ISO code; required unless the currency's names are given (major …) */
  currency?: string;
  /** style "currency": the label of the figure in brackets: code (default) · symbol / narrowSymbol (QR, $) · name · native (ر.ق.) */
  currencyDisplay?: "code" | "symbol" | "narrowSymbol" | "name" | "native";
  /** The places of the number (0–100). Default, as Intl: 3 for a decimal, 0 for a percentage; a currency rounds to its minor unit */
  maximumFractionDigits?: number;
  /** "halfExpand" (round half away from zero, the default, as Intl) or "trunc" (cut) */
  roundingMode?: "trunc" | "halfExpand";
  /** "auto" / "negative": «Negative» before a negative number (default) · "always": «Plus» before a number that is not
   *  negative · "exceptZero": «Plus» before a number above zero · "never": no sign, in the words or the figure */
  signDisplay?: "auto" | "always" | "exceptZero" | "negative" | "never";
  /** "us": no «and» (One Hundred Twenty-One) · "uk": «and»; default: the locale's (en and the American locales: us) */
  variant?: "us" | "uk";
  /** "indian": lakh and crore · "short": thousand, million; default: the locale's (en-IN, en-PK, en-BD, en-NP: indian) */
  scale?: "indian" | "short";
  /** The case of the words: by name, or the codes of toWords */
  textFormat?: "" | "title" | "upper" | "lower" | "sentence" | "U" | "L" | "S";
  /** "latn" only */
  numberingSystem?: "latn";
  localeMatcher?: "lookup" | "best fit";
}
/** A part of the words: Intl's type names where Intl has one; Arqam's own: minorCurrency, denominator, ordinal, prefix,
 *  suffix («Only») and figure (the figure in brackets, with its own parts as Intl cuts figures) */
export interface ArqamENPart {
  type: "literal" | "integer" | "decimal" | "fraction" | "currency" | "minorCurrency" | "denominator" | "minusSign" |
        "percentSign" | "ordinal" | "prefix" | "suffix" | "figure";
  value: string;
  parts?: {type: "literal" | "currency" | "minusSign" | "integer" | "group" | "decimal" | "fraction" | "percentSign"; value: string}[];
}
export interface ArqamENRangePart extends ArqamENPart { source: "startRange" | "endRange" | "shared" }
export interface ArqamENResolvedOptions extends ArqamENNumberFormatOptions {
  locale: string; numberingSystem: "latn"; style: "decimal" | "currency" | "percent" | "ordinal";
  roundingMode: "trunc" | "halfExpand"; signDisplay: "auto" | "always" | "exceptZero" | "negative" | "never"; variant: "us" | "uk"; scale: "indian" | "short";
}
/** A formatter: its methods are bound (list.map(nf.format) works); the object is frozen */
export interface ArqamENNumberFormat {
  format(x: ArqamENNumber): string;
  format(x: ArqamENNumber[]): string[];
  formatToParts(x: ArqamENNumber): ArqamENPart[];
  formatToParts(x: ArqamENNumber[]): ArqamENPart[][];
  /** «From A to B»; «Only» and the figure once; equal values give one value; a start after the end is a RangeError */
  formatRange(start: ArqamENNumber, end: ArqamENNumber): string;
  formatRangeToParts(start: ArqamENNumber, end: ArqamENNumber): ArqamENRangePart[];
  resolvedOptions(): ArqamENResolvedOptions;
}
/** arqamEN.NumberFormat: with or without new; the locale is optional ("en"), and an object first is the options */
export interface ArqamENNumberFormatConstructor {
  new (locales?: string | string[], options?: ArqamENNumberFormatOptions): ArqamENNumberFormat;
  new (options?: ArqamENNumberFormatOptions): ArqamENNumberFormat;
  (locales?: string | string[], options?: ArqamENNumberFormatOptions): ArqamENNumberFormat;
  (options?: ArqamENNumberFormatOptions): ArqamENNumberFormat;
  /** The English locales of the list, in their canonical form */
  supportedLocalesOf(locales?: string | string[]): string[];
  readonly styles: string[];
}
export interface ArqamEN {
  /** The words of a number with the shape, option names and methods of Intl.NumberFormat */
  readonly NumberFormat: ArqamENNumberFormatConstructor;
  readonly version: string;
  /** The words of a number or an amount; a string as the second argument is a currency code */
  toWords(n: ArqamENNumber, options?: ArqamENOptions | string): string;
  toWords(n: ArqamENNumber[], options?: ArqamENOptions | string): string[];
  /** Sets options for the calls that follow; "default" puts back the defaults */
  config(options: ArqamENOptions | "default"): void;
  /** Adds a currency, or changes one, for the rest of the session; returns its row. A new code needs major. */
  registerCurrency(code: string, attributes: ArqamENCurrencyAttributes): ArqamENCurrencyRow;
  /** Puts back the defaults */
  reset(): void;
  /** A copy of the options in force */
  options(): Required<ArqamENOptions>;
  /** The defaults */
  readonly defaults: Required<ArqamENOptions>;
  /** The currency table, by ISO code */
  readonly currencies: Record<string, ArqamENCurrencyRow>;
}
declare const arqamEN: ArqamEN;
export default arqamEN;
export declare const version: string;
export declare const currencies: Record<string, ArqamENCurrencyRow>;
export declare function toWords(n: ArqamENNumber, options?: ArqamENOptions | string): string;
export declare function toWords(n: ArqamENNumber[], options?: ArqamENOptions | string): string[];
export declare function config(options: ArqamENOptions | "default"): void;
export declare function registerCurrency(code: string, attributes: ArqamENCurrencyAttributes): ArqamENCurrencyRow;
export declare function reset(): void;
export declare function options(): Required<ArqamENOptions>;
export declare const NumberFormat: ArqamENNumberFormatConstructor;
