<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Dozent\SammelVertraege;

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

  protected function getRequestObj()
  {
    $result = new SammelvertraegeRequest();
    $result->seite = \GetOperations::getVarValue('seite', 1);
    $result->einstieg = \GetOperations::isDefined('einstieg');
    $result->aendereFilter = false;

    $type = \GetOperations::getVarValue('type', '0');
    if (!in_array($type, array('0', '1'))) {
      $type = '0';
    }

    $result->type = (int)$type;

    return $result;
  }

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