<?php
class View
{
    public static function render(string $view, array $data = []): void
    {
        extract($data, EXTR_SKIP);
        $currentUser = Auth::user();
        $settings = Settings::safeAll();
        $viewFile = APP_PATH . '/Views/' . $view . '.php';

        if (!file_exists($viewFile)) {
            http_response_code(404);
            exit('View não encontrada.');
        }

        ob_start();
        require $viewFile;
        $content = ob_get_clean();

        require APP_PATH . '/Views/layout.php';
    }
}
