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

namespace Kufer\KuferTools\Oeffentlich\PasswortAendern\PasswortAendernAnfordern;

use Kufer\KuferTools\Oeffentlich\PasswortAnfordern\Utils\HandlePasswortAnfordernEingaben as HandlePasswortAnfordern;

class PasswortAendernAnfordernPresenter extends \Kufer\KuferTools\Basis\Presenter\MitRahmenPresenter
{
  protected function getContent()
  {
    $view = $this->getView();

    return $view->getHeader();
  }

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

  protected function getViewModel()
  {
    $viewModel = new PasswortAendernAnfordernViewModel();
    $viewModel->errormsg = \array_map(function($pStatus): string {
      return HandlePasswortAnfordern::getMessageString($pStatus);
    }, HandlePasswortAnfordern::filterError($this->useCaseResponse->errormsg));
    $viewModel->login = $this->useCaseResponse->login;
    $viewModel->captcha_link_erweiterung = \time();
    $viewModel->https = $this->useCaseResponse->https;
    $viewModel->expiration_hours = $this->useCaseResponse->expiration_hours;

    return $viewModel;
  }
}