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

namespace Kufer\KuferTools\Veranstalter\KursUebersicht\Detailsreiter\Teilnehmer\HandleTnUmOrWeitermelden;

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

  protected function getRequestObj()
  {
    $requestObj = new HandleTnUmOrWeitermeldenRequest();
    $requestObj->action = \RequestOperations::getVarValue('actiontype');
    $requestObj->knr = \PostOperations::getVarValue('kurs');
    $requestObj->anmeldeKurs = \PostOperations::getVarValue('anmeldeKurs');
    $xsrf = new \Xsrf();
    $requestObj->xsrfKey = $xsrf->generateKey4Action($requestObj->action, $requestObj->knr . '_' . $requestObj->anmeldeKurs);
    $requestObj->belegIds = \PostOperations::getVarValue('belegIds');

    return $requestObj;
  }

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