<?php
declare(strict_types=1);

namespace App\Controllers;

require_once BASE_PATH . '/app/helpers/permissions.php';

use App\Core\Controller;

final class HealthController extends Controller
{
    public function index(): void
    {
        header('Content-Type: text/plain; charset=utf-8');
        echo "OK\n";
        echo "time=" . date('c') . "\n";
        echo "uid=" . (int)($_SESSION['user_id'] ?? 0) . "\n";
        echo "role=" . (function_exists('auth_role_code') ? auth_role_code() : 'NO') . "\n";
        echo "routes=" . (isset($GLOBALS['routes']) && is_array($GLOBALS['routes']) ? count($GLOBALS['routes']) : 0) . "\n";
    }
}
