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

namespace Kufer\Web\KuferTools\Dozent\Anwesenheiten\KurstageUebersicht;

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

  
  protected function getRequestObj()
  {
    $requestObj = new KurstageUebersichtRequest();
    $requestObj->einstieg = \GetOperations::isDefined('einstieg');

    $datum = \trim(\RequestOperations::getVarValue('datum', \DateTimeOperations::getDateNow()));
    $filter = new \InputfilterTools();
    $requestObj->datum = $filter->getValidDate($datum);
    if ($requestObj->datum == '01.01.2000') { 
      $requestObj->datum = \DateTimeOperations::getDateNow();
    }
    $requestObj->referer = \GetOperations::getVarValue('referer');
    $requestObj->refererLabel = \GetOperations::getVarValue('refererLabel');

    return $requestObj;
  }

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