<?php
declare(strict_types=1);

require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/tabular_reader.php';

if (session_status() !== PHP_SESSION_ACTIVE) {
    session_start();
}

app_bootstrap_ui_preferences();

app_ensure_dir(app_storage_path('uploads'));
app_ensure_dir(app_public_path('uploads'));
app_ensure_dir(app_public_path('uploads/companies'));
app_ensure_dir(app_public_path('uploads/imports'));

try {
    app_migrate();
    $GLOBALS['app_bootstrap_error'] = null;
} catch (Throwable $e) {
    $GLOBALS['app_bootstrap_error'] = $e->getMessage();
}
