<?php
require_once __DIR__ . '/bootstrap.php';

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

if (empty($_SESSION['user'])) {
    json_error('No autenticado', 401);
}

json_success([
    'user' => $_SESSION['user'],
    'rol' => $_SESSION['rol'] ?? null,
]);
