<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Dozent\KursUebersicht\Detailsreiter\Honorar\Demo\HonorarPdf;

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

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

    $requestObj->iban = \PostOperations::getVarValue('iban');
    $requestObj->bic = \PostOperations::getVarValue('bic');
    $requestObj->bank = \PostOperations::getVarValue('bank');

    $requestObj->honsatz_1 = \PostOperations::getVarValue('honsatz_1');
    $requestObj->honsatz_2 = \PostOperations::getVarValue('honsatz_2');
    $requestObj->honsatz_3 = \PostOperations::getVarValue('honsatz_3');

    $requestObj->stdanz_1 = \PostOperations::getVarValue('stdanz_1');
    $requestObj->stdanz_2 = \PostOperations::getVarValue('stdanz_2');
    $requestObj->stdanz_3 = \PostOperations::getVarValue('stdanz_3');

    $requestObj->honbetrag_1 = \PostOperations::getVarValue('honbetrag_1');
    $requestObj->honbetrag_2 = \PostOperations::getVarValue('honbetrag_2');
    $requestObj->honbetrag_3 = \PostOperations::getVarValue('honbetrag_3');

    $requestObj->hongesamt = \PostOperations::getVarValue('hongesamt');

    $requestObj->bemerkung = \PostOperations::getVarValue('bemerkung');
    $requestObj->ergaenzung = \PostOperations::getVarValue('ergaenzung');

    $requestObj->abrechnung_art = \PostOperations::getVarValue('abrechnung_art');

    $requestObj->signatureImage = \PostOperations::getVarValue('signature-pad-image');

    return $this->handleXsrf($requestObj, 'honorarabrechnung', $requestObj->knr);
  }

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