<?php

declare(strict_types=1);

require_once __DIR__ . '/../vendor/autoload.php';

use Core\App;
use Core\Dispatcher;
use Core\Mailer;
use Core\Request;
use Core\Router;

ensureSessionStarted();

require_once __DIR__ . '/../bootstrap/mail.php';
require_once __DIR__ . '/../bootstrap/sentinel.php';

$app = new App();
$app->bind('mailer', fn() => new Mailer());
$router = new Router();

require_once __DIR__ . '/../routes/web.php';

$dispatcher = new Dispatcher($router, $app);
$request = Request::capture();
$response = $dispatcher->dispatch($request);

$response->send();
