<?php

declare(strict_types=1);

$_SERVER['SCRIPT_NAME'] = '/karvi-pro/invoice/index.php';
$_SERVER['HTTP_HOST'] = 'pizzacalifornialotte.de';
$_SERVER['HTTPS'] = 'on';

require __DIR__ . '/../includes/bootstrap.php';
require __DIR__ . '/../includes/helpers.php';
require __DIR__ . '/../includes/contract_form.php';
require __DIR__ . '/../includes/contract_template.php';
require __DIR__ . '/../includes/contract_document_html.php';
require __DIR__ . '/../includes/invoice_contract.php';

$contract = [
    'invoice_mode' => 'pos',
    'contract_line' => 'Karvi POS',
    'contract_date' => '2026-06-18',
    'customer_details' => "Test GmbH\nFrankfurt",
    'line_items' => [[
        'description' => 'Karvi POS',
        'quantity' => 1,
        'unit_price_net' => 100,
        'total_net' => 100,
    ]],
    'totals' => ['total' => 119, 'net' => 100, 'vat' => 19],
];

$html = render_contract_document_html($contract);
echo strlen($html) > 100 ? 'OK invoice html=' . strlen($html) . PHP_EOL : "FAIL\n";
