<?php

declare(strict_types=1);

namespace ApiModel\Route;

use ApiModel\Action\HealthAction;
use ApiModel\Shared\Support\HttpRunner;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Routing\RouteCollectorProxy;

final class CoreRoutes
{
    public static function register(RouteCollectorProxy $g, HealthAction $healthAction): void
    {
        $g->get('', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $healthAction()));
    }
}
