<?php
    // Importa autoload do Composer
    require_once realpath(path: __DIR__ . '/../vendor/autoload.php');

    use AxiumPHP\AxiumPHP;
    use Workbloom\Config\Config;

    // ============================
    // Configurações globais
    // ============================
    $Config = Config::getInstance();

    // ============================
    // Inicializa AxiumPHP com configs
    // ============================
    $axiumPHP = new AxiumPHP(config: [
        'errors' => [
            'display_errors' => 1,
            'display_startup_errors' => 1,
            'log_errors' => 1,
            'error_log' => realpath(path: __DIR__ . '/../app/Storage/Logs/php-error.log'),
            'error_reporting' => E_ALL
        ],
        'constants' => [
            'ROUTER_MODE' => 'JSON', // JSON
            'APP_SYS_MODE' => 'DEV', // DEV | PROD
            'ROOT_SYSTEM_PATH' => realpath(path: __DIR__ . "/.."),
            'INI_SYSTEM_PATH' => realpath(path: __DIR__ . "/../app"),
            'MODULE_PATH' => realpath(path: __DIR__ . "/../app/Module"),
            'STORAGE_FOLDER_PATH' => realpath(path: __DIR__ . "/../app/Storage"),
            'COMPONENT_PATH' => realpath(path: __DIR__ . "/../app/Common/Component"),
            'ROUTER_ALLOWED_ORIGINS' => [
                '*'
            ]
        ],
        'system' => [
            'enable_session' => true,
            'default_timezone' => 'America/Fortaleza',
        ],
        'logger' => [
            'driver' => 'FILE',
            'logDir' => realpath(path: __DIR__ . '/../app/Storage/Logs')
        ]
    ]);

    // ============================
    // Carrega componentes
    // ============================
    require COMPONENT_PATH . "/Auth/bootstrap.php";

    // ============================
    // Dispara o roteador
    // ============================
    $axiumPHP->routerDispatch();