<?php
namespace Incoviba\Controller\Ventas;

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

class Creditos extends Controller
{
    public function show(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.creditos', compact('venta', 'bancos'));
    }
}
