<?php

declare(strict_types=1);

namespace App\Controllers;

use App\ViewModels\HomeIndexViewModel;
use Core\Controller;

class HomeController extends Controller
{
    public function index()
    {
        $model = new HomeIndexViewModel();
        $model->title = 'MindVisionCode PHP';
        $model->eyebrow = 'Small MVC framework';
        $model->message = 'A lightweight PHP MVC starter with a central dispatcher, clean controllers, SQLite-backed repositories, and readable conventions.';
        $model->routeExample = '/users/123';

        return $this->view('home.index', [
            'model' => $model,
            'pageTitle' => $model->title,
        ]);
    }

    public function user(string $id)
    {
        return $this->json([
            'userId' => $id,
        ]);
    }
}
