<?php

namespace Kufer\Web\KuferTools\Dozent\HonorarBfi\Honorardruck;

class HonorardruckPresenter extends \Kufer\Web\KuferTools\Basis\Presenter\Presenter
{
  public function present()
  {
    return base64_decode($this->useCaseResponse->honorarDokument->ContentBase64);
  }

  public function setRequestHeader()
  {
    $contentType = \FSOperations::getContentTypeByFileName($this->useCaseResponse->vertragsDokument->DateiName);

    if ($contentType) {
      header('Content-Type: ' . $contentType);
    }
    $fileParts = \FSOperations::getFileParts($this->useCaseResponse->honorarDokument->DateiName);
    $fileExtension = isset($fileParts['extension']) ? $fileParts['extension'] : 'pdf';
    header('Content-Disposition: attachment; filename="honorarabrechnung.' . $fileExtension . '"');
  }

  public function getEncoding()
  {
    return UTF_8;
  }

  public function getExternalEncoding()
  {
    return $this->getEncoding();
  }

  protected function getView()
  {
    return null;
  }

  protected function getViewModel()
  {
    return null;
  }
}