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

namespace Kufer\web\KuferTools\Teilnehmer\Visitenkarten\VisitenkartenDetails\VisitenkartenDetailsSpeichern;

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

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

  protected function getControllerToForward($pUseCaseResponse)
  {
    return new VisitenkartenDetailsNachSpeichernController($pUseCaseResponse->statusCode);
  }

  protected function getRequestObj()
  {
    $requestObj = new VisitenkartenDetailsSpeichernRequest();
    $requestObj->visitenkarteId = \GetOperations::getVarValue('karteID');

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

    $requestObj->wssHandler = $wssHandler;

    $action = $this->getActionVal();

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