declare module "@univerjs/sheets-numfmt/facade" {
  import type { INumfmtLocaleTag } from "@univerjs/core";

  import type { FRange, FWorkbook } from "@univerjs/sheets/facade";

  interface IFRangeSheetsNumfmtMixin {
      /**
       * Set the number format of the range.
       * @param {string} pattern - The number format pattern.
       * @returns {FRange} The FRange instance for chaining.
       * @example
       * ```ts
       * const fWorkbook = univerAPI.getActiveWorkbook();
       * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
       * if (!fWorksheet) return;
       *
       * // Set the number format of the A1 cell to '#,##0.00'.
       * const fRange = fWorksheet.getRange('A1');
       * fRange.setValue(1234.567).setNumberFormat('#,##0.00');
       * console.log(fRange.getDisplayValue()); // 1,234.57
       * ```
       */
      setNumberFormat(pattern: string): FRange;
      /**
       * Sets a rectangular grid of number formats (must match dimensions of this range).
       * @param {string[][]} patterns - A two-dimensional array of number formats.
       * @returns {FRange} The FRange instance for chaining.
       * @example
       * ```ts
       * const fWorkbook = univerAPI.getActiveWorkbook();
       * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
       * if (!fWorksheet) return;
       *
       * // Set the number formats of the A1:B2 range.
       * const fRange = fWorksheet.getRange('A1:B2');
       * fRange.setValues([
       *   [1234.567, 0.1234],
       *   [45658, 0.9876]
       * ]).setNumberFormats([
       *   ['#,##0.00', '0.00%'],
       *   ['yyyy-MM-DD', '']
       * ]);
       * console.log(fRange.getDisplayValues()); // [['1,234.57', '12.34%'], ['2025-01-01', 0.9876]]
       * ```
       */
      setNumberFormats(patterns: string[][]): FRange;
      /**
       * Get the number formatting of the top-left cell of the given range. Empty cells return an empty string.
       * @returns {string} The number format of the top-left cell of the range.
       * @example
       * ```ts
       * const fWorkbook = univerAPI.getActiveWorkbook();
       * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
       * if (!fWorksheet) return;
       *
       * // Get the number format of the top-left cell of the A1:B2 range.
       * const fRange = fWorksheet.getRange('A1:B2');
       * console.log(fRange.getNumberFormat());
       * ```
       */
      getNumberFormat(): string;
      /**
       * Returns the number formats for the cells in the range.
       * @returns {string[][]} A two-dimensional array of number formats.
       * @example
       * ```ts
       * const fWorkbook = univerAPI.getActiveWorkbook();
       * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
       * if (!fWorksheet) return;
       *
       * // Get the number formats of the A1:B2 range.
       * const fRange = fWorksheet.getRange('A1:B2');
       * console.log(fRange.getNumberFormats());
       * ```
       */
      getNumberFormats(): string[][];
  }

  class FRangeSheetsNumfmtMixin {
      setNumberFormat(pattern: string): FRange;
      setNumberFormats(patterns: string[][]): FRange;
      getNumberFormat(): string;
      getNumberFormats(): string[][];
  }

  interface IFWorkbookSheetsNumfmtMixin {
      /**
       * Set the locale for number formatting.
       * @param {INumfmtLocaleTag} locale zh_CN,zh_TW,zh_HK,ja,ko,th,cs,da,nl,en,en_AU,en_CA,en_GB,en_IE,fi,fr,fr_CA,fr_CH,de,de_CH,el,hu,is,id,it,it_CH,nb,no,pl,pt,pt_BR,ru,sk,es,es_AR,es_BO,es_CL,es_CO,es_EC,es_MX,es_PY,es_UY,es_VE,sv,tr,cy,az,be,bg,ca,fil,gu,he,hr,hy,ka,kk,kn,lt,lv,ml,mn,mr,my,pa,ro,sl,sr,ta,te,uk,vi,ar,bn,hi
       * @returns {FWorkbook} The FWorkbook instance for chaining.
       * @memberof IFWorkbookNumfmtMixin
       * @example
       * ```ts
       * const fWorkbook = univerAPI.getActiveWorkbook();
       * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
       * if (!fWorksheet) return;
       * const fRange = fWorksheet.getRange('A1');
       * fRange.setValue(1234.567).setNumberFormat('#,##0.00');
       *
       * // Set the locale en_US for number formatting.
       * fWorkbook.setNumfmtLocal('en_US');
       * console.log(fRange.getDisplayValue()); // 1,234.57
       *
       * // Set the locale de_DE for number formatting.
       * fWorkbook.setNumfmtLocal('de_DE');
       * console.log(fRange.getDisplayValue()); // 1.234,57
       * ```
       */
      setNumfmtLocal(locale: INumfmtLocaleTag): FWorkbook;
  }

  class FWorkbookSheetsNumfmtMixin {
      setNumfmtLocal(locale: INumfmtLocaleTag): FWorkbook;
  }
}

declare module "@univerjs/sheets/facade" {
  import type { IFRangeSheetsNumfmtMixin, IFWorkbookSheetsNumfmtMixin } from "@univerjs/sheets-numfmt/facade";

  interface FRange extends IFRangeSheetsNumfmtMixin {
  }
}

declare module "@univerjs/sheets/facade" {
  import type { IFRangeSheetsNumfmtMixin, IFWorkbookSheetsNumfmtMixin } from "@univerjs/sheets-numfmt/facade";

  interface FWorkbook extends IFWorkbookSheetsNumfmtMixin {
  }
}
