<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Dozent\Urlaube\Uebersicht;

use Kufer\Web\KuferTools\Utils\FilterSearch\ISearchFilter;
use Kufer\Web\KuferTools\Utils\FilterSearch\WunschtermineSearchFilter;

class UrlaubeController extends \Kufer\Web\KuferTools\Basis\Controller\Controller
{
  
  protected function getUseCase(): \Kufer\Web\KuferTools\Basis\UseCase\UseCase
  {
    return new UrlaubeUseCase($this->getRequestObj());
  }

  
  protected function getRequestObj()
  {
    $requestObj = new UrlaubeRequest();
    $requestObj->seite = \GetOperations::getVarValue('seite');
    $requestObj->einstieg = \GetOperations::isDefined('einstieg');
    $requestObj->aendereFilter = false;

    if ($requestObj->einstieg) {
      
      

      $suchApi = $this->getSuchAPI();
      if (!is_null($suchApi)) {
        $requestObj->suchParameter = $suchApi->getSearchMapEmptyValues();
        $requestObj->aendereFilter = true;
      }
    }

    return $requestObj;
  }

  
  protected function getPresenter($pUseCaseResponse)
  {
    return new UrlaubePresenter($pUseCaseResponse);
  }

  protected function getToolId(): int
  {
    return UrlaubeUseCase::getToolId();
  }

  protected function getSuchApi(): ?ISearchFilter
  {
    return new WunschtermineSearchFilter();
  }
}