<?php

declare(strict_types=1);

namespace App\Controller\Query;

use App\CustomResponse as Response;
use Fig\Http\Message\StatusCodeInterface;
use Psr\Http\Message\ServerRequestInterface as Request;

final class Sql extends Base
{
    public function __invoke(Request $request, Response $response, array $args): Response
    {
        $input = (array) $request->getParsedBody();
        $Query = $this->getQueryService()->sql($input, (int) $args['id']);

        return $response->withJson($Query, StatusCodeInterface::STATUS_CREATED);
    }
}
