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

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

use Kufer\KuferTools\Basis\UseCase\BasisResponse;
use Kufer\Web\KuferTools\Dozent\Urlaube\Uebersicht;
use webbasys\includee\datamenu\DataMenuKurseGroupALaIhk\AlternatMapHelper;

class UrlaubeShowFilterUseCase extends \Kufer\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 BasisResponse
{
  public $toolId;
  public $datumVon;
  public $datumBis;
  public $grund;
}