<?php
namespace Incoviba\Controller\Contabilidad;

use DateTimeImmutable;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Incoviba\Common\Ideal;
use Incoviba\Service;

class Informes extends Ideal\Controller
{
    public function tesoreria(ServerRequestInterface $request, ResponseInterface $response, Service\Contabilidad\Informe\Tesoreria $tesoreriaService, string $fecha): ResponseInterface
    {
        $fecha = new DateTimeImmutable($fecha);

        $tesoreriaService->getOutput()->buildInforme($fecha, $tesoreriaService->getOutput()->build($fecha));
        $response->getBody()->write(file_get_contents('php://output'));
        return $response;
    }
}
