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

namespace Kufer\Web\KuferTools\Basis\KursDetails\Feedback;

class SendFeedbackPresenter extends \Kufer\Web\KuferTools\Basis\Presenter\MitRahmenPresenter
{
  protected function getContent()
  {
    if (!$this->useCaseResponse->emailStatus->hasErrors() && !$this->useCaseResponse->isRefresh) {
      return parent::getContent();
    } else {
      $view = $this->getView();

      return $view->getNoColumn();
    }
  }

  protected function getView()
  {
    return new SendFeedbackView($this->getViewModel());
  }

  protected function getViewModel()
  {
    $viewModel = new SendFeedbackViewModel();
    $viewModel->kurs = $this->useCaseResponse->kurs;
    $viewModel->emailStatus = $this->useCaseResponse->emailStatus;
    $viewModel->action = $this->useCaseResponse->action;
    $viewModel->toolId = $this->useCaseResponse->toolId;
    $viewModel->isRefresh = $this->useCaseResponse->isRefresh;

    return $viewModel;
  }

  protected function getJsFilesSrcAryWeitere(): array
  {
    return array(
      $this->getJsFileFromSys('kontaktformular.js')
    );
  }

  protected function getSeitenTitel(): string
  {
    return 'Feedback zum Kurs ' . $this->useCaseResponse->kurs->id;
  }
}