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

namespace Kufer\KuferTools\Dozent\KursUebersicht\Detailsreiter\Teilnehmer\VerhaltensListe;

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

  protected function getRequestObj()
  {
    $requestObj = new VerhaltensListeRequest();
    $requestObj->knr = \GetOperations::getVarValue('knr');
    $toolId = VerhaltensListeUseCase::getToolId();
    
    if (\PostOperations::isDefined('verhaltenslisteobj')) {
      
      $requestObj->verhaltensListeObj = \JsonOperations::getFromStringBase64(\PostOperations::getVarValue('verhaltenslisteobj'));
      
      \SessionOperations::setVarValueWTIntern('verhaltenslisteobj_' . $toolId, $requestObj->verhaltensListeObj);
    } else {  
      $requestObj->verhaltensListeObj = \SessionOperations::getVarValueWTIntern('verhaltenslisteobj_' . $toolId);
    }

    return $requestObj;
  }

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