<?php

declare(strict_types=1);

namespace ApiModel\Route;

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

final class CanjeRoutes
{
    public static function register(RouteCollectorProxy $g, CanjeAction $action, string $uuid): void
    {
        $g->get('/canjes', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->listar($request)));
        $g->post('/canjes', fn (ServerRequestInterface $request, ResponseInterface $response) => HttpRunner::runJson($request, $response, fn () => $action->registrar($request)));
    }
}
