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

// Mock the 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';

// Decode base64 arguments safely
$base64 = $argv[1] ?? '';
$payload = json_decode(base64_decode($base64), true) ?: [];

// Mock POST variables
$_POST = $payload;

// Include standard configs and API
// Since working directory is now api/, relative paths in config/db need to be accessed from parent directory
require_once '../config.php';
require_once '../includes/db.php';
require_once '../includes/auth.php';
require_once 'invoices.php';
?>
