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

namespace Kufer\Web\KuferTools\Dozent\Wunschtermine\Uebersicht\Filter;

use Kufer\Web\KuferTools\Basis\UseCase\ToolResponse;
use Kufer\Web\KuferTools\Dozent\Wunschtermine\Uebersicht;

class WunschtermineShowFilterUseCase extends \Kufer\Web\KuferTools\Basis\UseCase\ToolUseCase
{
  public function __construct($request)
  {
    parent::__construct($request, new WunschtermineShowFilterResponse());
  }

  public static function getToolId()
  {
    return Uebersicht\WunschtermineUseCase::getToolId();
  }

  public static function getToolSectionId()
  {
    return Uebersicht\WunschtermineUseCase::getToolSectionId();
  }

  public function action()
  {
    return $this->getResponse();
  }

  private function setFilterVals()
  {
    $searchAPI = new \Kufer\Web\KuferTools\Utils\FilterSearch\WunschtermineSearchFilter();
    $fromobject = $searchAPI->getSearchMapFromSession($this->getToolId());
    $this->response->datumVon = $fromobject['DatumVon'];
    $this->response->datumBis = $fromobject['DatumBis'];
    $this->response->zeitVon = $fromobject['ZeitVon'];
    $this->response->zeitBis = $fromobject['ZeitBis'];
    $this->response->bemerkung = $fromobject['Bemerkung'];
    $this->response->toolId = $this->getToolId();
  }

  protected function getResponse()
  {
    $this->setFilterVals();

    return $this->response;
  }
}

class WunschtermineShowFilterRequest
{
}

class WunschtermineShowFilterResponse extends ToolResponse
{
  public $toolId;
  public $datumVon;
  public $datumBis;
  public $zeitVon;
  public $zeitBis;
  public $bemerkung;
}