<?php
namespace Incoviba\Controller;

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

class Inmobiliarias
{
    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, View $view, Repository\Inmobiliaria $inmobiliariaRepository): ResponseInterface
    {
        $inmobiliarias = $inmobiliariaRepository->fetchAll();
        return $view->render($response, 'inmobiliarias.list', compact('inmobiliarias'));
    }
    public function show(ServerRequestInterface $request, ResponseInterface $response, View $view, Repository\Inmobiliaria $inmobiliariaRepository, int $inmobiliaria_rut): ResponseInterface
    {
        $inmobiliaria = $inmobiliariaRepository->fetchById($inmobiliaria_rut);
        return $view->render($response, 'inmobiliaria.show', compact('inmobiliaria'));
    }
}
