<?php
declare(strict_types=1);

/**
 * Bootstrap for CLI cron scripts (no router, no HTTP session). Included by
 * every file under /cron.
 */

use App\Core\Config;

$appRoot = __DIR__;

spl_autoload_register(function (string $class) use ($appRoot) {
    if (strpos($class, 'App\\') !== 0) return;
    $relative = substr($class, strlen('App\\'));
    $file = $appRoot . '/' . str_replace('\\', '/', $relative) . '.php';
    if (is_file($file)) require $file;
});

require $appRoot . '/Core/helpers.php';

Config::load();
date_default_timezone_set(Config::get('app.timezone', 'UTC'));
error_reporting(E_ALL & ~E_DEPRECATED);
