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

namespace Kufer\Web\KuferTools\Dozent\Anwesenheiten\AnwesenheitenSpeichern;

use Kufer\Mail\EMail\IEMail;

class AnwesenheitenSpeichernAbweichendeUEEMailPresenter extends \Kufer\Web\KuferTools\Basis\Presenter\Presenter implements IEMail
{
  
  private $view;

  
  private $viewModel;

  public function __construct($viewModel)
  {
    $this->viewModel = $viewModel;
  }

  public function present()
  {
    $view = $this->getView();

    return $view->getHeader() . $view->getBody() . $view->getFooter();
  }

  
  public function getBetreff()
  {
    return $this->getView()->getNoData();
  }

  protected function createView(): \Kufer\Web\KuferTools\Basis\View\ViewSight
  {
    return new AnwesenheitenSpeichernAbweichendeUEEMailView($this->getViewModel());
  }

  
  protected function getView()
  {
    $this->view = $this->view ?? $this->createView();

    return $this->view;
  }

  
  protected function getViewModel()
  {
    return $this->viewModel;
  }

  public function getSubject(): string
  {
    return $this->getBetreff();
  }

  public function getContent(): string
  {
    return $this->present();
  }

  public function getContentType(): int
  {
    return IEMail::TYPE_HTML;
  }

  public function getAttachments(): array
  {
    return array();
  }
}