<?php

namespace App\Core;

abstract class Controller
{
    protected function render(string $view, array $data = []): Response
    {
        $content = View::render($view, $data);
        $layoutData = array_merge($data, ['content' => $content]);
        return new Response(View::render('layout', $layoutData));
    }

    protected function json(array $data, int $status = 200): Response
    {
        return Response::json($data, $status);
    }
}
