<?php

class View
{
    public static function render(string $view, array $data = []): void
    {
        extract($data);
        $viewPath = APP_ROOT . '/app/views/pages/' . $view . '.php';

        if (!file_exists($viewPath)) {
            throw new RuntimeException('Vista no encontrada: ' . $view);
        }

        require APP_ROOT . '/app/views/layout/header.php';
        require $viewPath;
        require APP_ROOT . '/app/views/layout/footer.php';
    }
}
