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

namespace Kufer\Web\KuferTools\Mitarbeiter\AdressInfo\AdressUebersicht\FilterAdressUebersicht;

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

  public static function getToolId()
  {
    return \ToolsAPI::TOOL_ADRESSINFO_MA; 
  }

  public static function getToolSectionId()
  {
    return 55;
  }

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

  private function setFilterVals()
  {
    $searchAPI = new \Kufer\Web\KuferTools\Utils\FilterSearch\AdressenSearchFilter();
    
    $fromobject = $searchAPI->getSearchMapFromSession('tool' . $this->getToolId());
    $this->response->name = $fromobject['name'];
    $this->response->adrId = $fromobject['adrnr'];
    $this->response->vorname = $fromobject['vorname'];
    $this->response->strasse = $fromobject['strasse'];
    $this->response->ort = $fromobject['wohnort'];
  }

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

    return $this->response;
  }
}

class FilterAdressUebersichtRequest
{
}

class FilterAdressUebersichtResponse extends \Kufer\Web\KuferTools\Basis\UseCase\ToolResponse
{
  public $name;
  public $vorname;
  public $strasse;
  public $ort;
  public $adrId;
}