<?php
// ── Session Setup ────────────────────────────────────────────
if (session_status() === PHP_SESSION_NONE) {
    session_set_cookie_params([
        'lifetime' => 7200,
        'path'     => '/',
        'secure'   => false,        // Set true in production (HTTPS)
        'httponly' => true,
        'samesite' => 'Lax',
    ]);
    session_start();
}

// Regenerate session ID on first request of the session
if (empty($_SESSION['_sid_set'])) {
    session_regenerate_id(true);
    $_SESSION['_sid_set'] = 1;
}

// Load configuration + helpers
require_once __DIR__ . '/../config/app.php';
require_once __DIR__ . '/../config/db.php';
require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/whatsapp.php';
