import type { VatScheduleEntry } from './resolve.js'

/**
 * Israel VAT rate history — byte-faithful `IL_VAT_RATES` seed.
 * Sources: Israeli Tax Authority historical records.
 */
export const IL_VAT_SCHEDULE: readonly VatScheduleEntry[] = [
  { effectiveFrom: '1976-07-01', value: '0.0800', unit: 'fraction' },
  { effectiveFrom: '1977-11-01', value: '0.1200', unit: 'fraction' },
  { effectiveFrom: '1982-08-01', value: '0.1500', unit: 'fraction' },
  { effectiveFrom: '1985-06-01', value: '0.1700', unit: 'fraction' },
  { effectiveFrom: '1985-10-01', value: '0.1500', unit: 'fraction' },
  { effectiveFrom: '1990-03-01', value: '0.1600', unit: 'fraction' },
  { effectiveFrom: '1991-01-01', value: '0.1800', unit: 'fraction' },
  { effectiveFrom: '1993-01-01', value: '0.1700', unit: 'fraction' },
  { effectiveFrom: '2002-06-15', value: '0.1800', unit: 'fraction' },
  { effectiveFrom: '2004-03-01', value: '0.1700', unit: 'fraction' },
  { effectiveFrom: '2005-09-01', value: '0.1650', unit: 'fraction' },
  { effectiveFrom: '2006-07-01', value: '0.1550', unit: 'fraction' },
  { effectiveFrom: '2009-07-01', value: '0.1650', unit: 'fraction' },
  { effectiveFrom: '2010-01-01', value: '0.1600', unit: 'fraction' },
  { effectiveFrom: '2012-09-01', value: '0.1700', unit: 'fraction' },
  { effectiveFrom: '2013-06-02', value: '0.1800', unit: 'fraction' },
  { effectiveFrom: '2015-10-01', value: '0.1700', unit: 'fraction' },
  { effectiveFrom: '2025-01-01', value: '0.1800', unit: 'fraction' },
] as const

/** EU per-country standard-rate schedules — scaffold; extend with full matrix over time. */
export const EU_VAT_SCHEDULES: Readonly<Record<string, readonly VatScheduleEntry[]>> = {
  DE: [{ effectiveFrom: '2007-01-01', value: 19, unit: 'percent' }],
  FR: [{ effectiveFrom: '2014-01-01', value: 20, unit: 'percent' }],
}

/**
 * EU reduced-rate category matrix — structure scaffold only.
 * Keys = category id; values = per-country rate in **basis points** (host resolves
 * category). Basis points (not percent) so non-integer reduced rates — e.g. FR 5.5%
 * = 550 bp — are represented losslessly; a float `5.5` would break the integer-only
 * `percent`/`basisPoints` normalizers (`BigInt(5.5)` throws).
 */
export const EU_REDUCED_RATE_MATRIX: Readonly<
  Record<string, Readonly<Record<string, number>>>
> = {
  food: { DE: 700, FR: 550 },
  books: { DE: 700, FR: 550 },
}
