import { Invoice } from '../types/invoice.types';
import fs from 'fs';
import path from 'path';

/**
 * Lädt die zentrale Testdaten-JSON-Datei
 */
export function loadTestInvoice(): Invoice {
  const testDataPath = path.join(process.cwd(), 'data', 'test-invoice.json');
  
  if (!fs.existsSync(testDataPath)) {
    throw new Error(`Testdaten-Datei nicht gefunden: ${testDataPath}`);
  }
  
  const jsonContent = fs.readFileSync(testDataPath, 'utf8');
  return JSON.parse(jsonContent);
}

/**
 * Lädt die Testdaten und gibt sie als InvoiceData-Objekt zurück (für Tests)
 */
export function loadTestInvoiceData() {
  const invoice = loadTestInvoice();
  
  return {
    invoices: [invoice],
    extractionDate: "2025-01-30T12:00:00Z",
    invoiceCount: 1,
    formatVersion: "1.0",
    description: "Test invoice data"
  };
} 