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

namespace Kufer\KuferTools\Dozent\Kursplanung\TerminBearbeiten;

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

  
  protected function getRequestObj()
  {
    $requestObj = new TerminBearbeitenAbsendenRequest();
    $requestObj->ktId = \GetOperations::getVarValue('ktId');

    $wssHandler = new \Kufer\KuferTools\Utils\WssHandler(TerminBearbeitenAbsendenUseCase::getToolSectionId(), TerminBearbeitenAbsendenUseCase::getUser());
    $requestObj->columnValues = $wssHandler->getColumnValuesFromPost();
    $requestObj->wssHandler = $wssHandler;

    $action = $this->getActionVal();

    return $this->handleXsrf($requestObj, $action, $requestObj->ktId);
  }

  protected function getControllerToForward($pUseCaseResponse)
  {
    return new TerminBearbeitenNachAbsendenController($pUseCaseResponse->kurstag->kurs->id, $pUseCaseResponse->kurstag->id, $pUseCaseResponse->statusCode, $pUseCaseResponse->wrongFields, $pUseCaseResponse->changedKurstag);
  }

  protected function getPresenter($pUseCaseResponse)
  {
    return null;
  }
}