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

namespace Kufer\KuferTools\Basis\Presenter;

use Kufer\KuferTools\Basis\View\BasisViewModel;


class JsonPresenterStringOnly extends Presenter
{
  
  private $encodeFlags;

  public function __construct($useCaseResponse, int $encodeFlags = 0)
  {
    parent::__construct($useCaseResponse);
    $this->encodeFlags = $encodeFlags;
  }

  public function setRequestHeader()
  {
    header('Content-Type: application/json; charset=' . UTF_8);
  }

  public function present()
  {
    return json_encode(\StringOperations::objectConvertStringEncoding($this->useCaseResponse, \CodingOperations::getInternalEncoding(), UTF_8), $this->encodeFlags, 16);
  }

  public function getExternalEncoding()
  {
    return UTF_8;
  }

  protected function getViewModel()
  {
    return new BasisViewModel();
  }

  protected function getView()
  {
    return null;
  }
}