<?php
// /api/v1/debug/debug.session.php

declare(strict_types=1);

function debug_session_handle_request(): array
{
    if (session_status() !== PHP_SESSION_ACTIVE) {
        session_start();
    }

    return [
        'ok'         => true,
        'session_id' => session_id(),
        'session'    => $_SESSION,
        'cookies'    => $_COOKIE,
        'server'     => [
            'host' => $_SERVER['HTTP_HOST']   ?? null,
            'uri'  => $_SERVER['REQUEST_URI'] ?? null,
        ],
    ];
}
