/**
 * Synthetic CSV corpus for the import-format work (issue #326).
 *
 * Every file in this directory is INVENTED. No real bank statement, no real
 * account number, no real transaction ever lands in the repository — the app is
 * privacy-first and the corpus has to be readable by anyone. Synthetic is not a
 * compromise here: these files deliberately cover shapes a single real statement
 * never contains at once (a reversed debit/credit pair, an unused column filled
 * with `0,00`, a header cell carrying a number), which is precisely the point.
 *
 * The corpus is the reference the detection rewrite (#323-#332) measures itself
 * against. Read `csvAutoDetect.test.ts` for the frozen contract, including the
 * cases that are frozen as DEFECTIVE.
 */

import { readFileSync } from "fs";
import { resolve } from "path";

/** Stable identifier of each corpus case. */
export type CsvFixtureName =
  | "signed-amount"
  | "debit-credit"
  | "debit-credit-reversed"
  | "unused-column-zero"
  | "preamble"
  | "header-with-number"
  | "header-numeric-label"
  | "no-header"
  | "all-positive"
  | "desjardins-quoted"
  | "absolute-indicator";

/** Every case in the corpus, in the order the issue lists them. */
export const CSV_FIXTURE_NAMES: readonly CsvFixtureName[] = [
  "signed-amount",
  "debit-credit",
  "debit-credit-reversed",
  "unused-column-zero",
  "preamble",
  "header-with-number",
  "header-numeric-label",
  "no-header",
  "all-positive",
  "desjardins-quoted",
  "absolute-indicator",
];

/**
 * Read one fixture as raw text, exactly as `useImportWizard` receives it from
 * the file-reading Tauri command — no trimming, no normalisation.
 */
export function readCsvFixture(name: CsvFixtureName): string {
  return readFileSync(resolve(import.meta.dirname, `${name}.csv`), "utf-8");
}
