<?php
namespace Incoviba\Controller;

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

class Base
{
    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Login $service): ResponseInterface
    {
        if ($service->isIn()) {
            return $this->home($response, $view);
        }
        return $this->login($response, $view);
    }
    public function construccion(ServerRequestInterface $request, ResponseInterface $response, View $view): ResponseInterface
    {
        return $view->render($response, 'construccion');
    }
    protected function home(ResponseInterface $response, View $view): ResponseInterface
    {
        return $view->render($response, 'home');
    }
    protected function login(ResponseInterface $response, View $view): ResponseInterface
    {
        return $view->render($response, 'guest');
    }
}
