<?php

declare(strict_types=1);

require_once __DIR__ . '/config.php';
require_once __DIR__ . '/csv_store.php';
require_once __DIR__ . '/auth.php';
require_once __DIR__ . '/response.php';

date_default_timezone_set('UTC');

if (!is_dir(DATA_DIR)) {
    mkdir(DATA_DIR, 0777, true);
}

// Tighten session settings a bit (works fine on local XAMPP)
session_name(SESSION_NAME);
session_set_cookie_params([
    'lifetime' => 0,
    'path' => '/',
    'httponly' => true,
    'samesite' => 'Lax',
    'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'),
]);

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