<?php
namespace Incoviba\Controller\Ventas;

use Incoviba\Common\Alias\View;
use Incoviba\Repository;
use Incoviba\Service;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

class Escrituras
{
    public function show(ServerRequestInterface $request, ResponseInterface $response, View $view,
                         Repository\Venta\TipoEstadoPago $estadoPagoRepository,
                         Service\Venta $ventaService, int $venta_id): ResponseInterface
    {
        $venta = $ventaService->getById($venta_id);
        $estados = $estadoPagoRepository->fetchAll();
        return $view->render($response, 'ventas.escrituras.show', compact('venta', 'estados'));
    }
    public function informe(ServerRequestInterface $request, ResponseInterface $response, View $view,
                            Service\Venta $ventaService, int $venta_id): ResponseInterface
    {
        $venta = $ventaService->getById($venta_id);
        return $view->render($response, 'ventas.escrituras.informe', compact('venta'));
    }
    public function add(ServerRequestInterface $request, ResponseInterface $response, View $view,
                        Service\Venta          $ventaService, Repository\Contabilidad\Banco $bancoRepository,
                        int                    $venta_id): ResponseInterface
    {
        $venta = $ventaService->getById($venta_id);
        $bancos = $bancoRepository->fetchAll('nombre');
        return $view->render($response, 'ventas.escrituras.add', compact('venta', 'bancos'));
    }
}
