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

namespace Kufer\KuferTools\Veranstalter\LeiterMitarbeiterAndererVeranstalter\SammelEMail;

class SendSammelEMailController extends \Kufer\KuferTools\Basis\Controller\ToolController
{
  protected function getRequestObj()
  {
    $requestObj = new \Kufer\KuferTools\Basis\DozentenInfo\SammelEMail\SendSammelEMailRequest();
    $requestObj->emailBetreff = \PostOperations::getVarValue('email_betreff');
    $requestObj->emailBody = \PostOperations::getVarValue('email_body');

    
    $action = \GetOperations::getVarValue('action');
    $requestObj = $this->handleXsrf($requestObj, $action);

    
    $requestObj->dozNummern = \PostOperations::getVarValue('dozenten', array());
    $requestObj->anhangTnList = \PostOperations::isDefined('anhangTnList');

    return $requestObj;
  }

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

  protected function getUseCase(): \Kufer\KuferTools\Basis\UseCase\UseCase
  {
    return new SendSammelEMailUseCase(
      $this->getRequestObj()
    );
  }
}