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

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

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

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

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

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

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

  private function setFilterVals()
  {
    $searchAPI = new \Kufer\Web\KuferTools\Utils\FilterSearch\DozUrlaubeSearchFilter();
    $fromobject = $searchAPI->getSearchMapFromSession($this->getToolId());
    $this->response->datumVon = $fromobject['DatumVon'];
    $this->response->datumBis = $fromobject['DatumBis'];
    $this->response->grund = $fromobject['Grund'];
    $this->response->toolId = $this->getToolId();
  }

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

    return $this->response;
  }
}

class UrlaubeShowFilterRequest
{
}

class UrlaubeShowFilterResponse extends ToolResponse
{
  public $toolId;
  public $datumVon;
  public $datumBis;
  public $grund;
}