<?php
$workspace_path = "c:\\Users\\User\\Documents\\Antigravity Projects\\Apperal Managment System -Vanila- PHP";
chdir($workspace_path . "\\api");

// Start mock session
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}
$_SESSION['user_id'] = 1;
$_SESSION['user_role'] = 'owner';
$_SESSION['role'] = 'owner';
$_SESSION['company_id'] = 1;
$_SESSION['company_name'] = 'NexCore Apparel';
$_SESSION['company_currency'] = 'LKR';

// Define inputs for multiple products
$_POST = [
    'action' => 'create',
    'buyer_name' => 'Multi Zara Test',
    'buyer_brand' => 'Zara Kids & Man',
    'buyer_contact' => 'Jane Smith',
    'buyer_email' => 'jane@zaratest.com',
    'buyer_phone' => '+34 699 999 999',
    'buyer_country' => 'Spain',
    'products' => [
        [
            'name' => 'Denim Jacket XL',
            'sku' => 'DJ-XL-001',
            'description' => 'Premium XL Denim Jacket',
            'quantity' => 15,
            'unit_price' => 2500.00
        ],
        [
            'name' => 'Slim Fit Chino L',
            'sku' => 'CH-L-002',
            'description' => 'Beige Slim Fit Chinos',
            'quantity' => 20,
            'unit_price' => 1800.00
        ]
    ],
    'taxes_vat' => 200.00,
    'discounts' => 100.00,
    'shipping_charges' => 300.00,
    'po_reference' => 'PO-MULTI-001',
    'payment_terms' => 'Advance Payment',
    'payment_term_id' => 1,
    'due_date' => '2026-07-15'
];

// Include the api directly (which outputs json and exits)
require_once 'invoices.php';
?>
