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

namespace Kufer\KuferTools\Allgemein\PersoenlicheDaten\BankdatenAnhandIban;

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

  public static function getToolId()
  {
    return 13;
  }

  public static function getToolSectionId()
  {
    return 90;
  }

  
  public function hasAccess($pToolSectionId = null)
  {
    $user = $this->getUser();
    $dbwTools = new \DBWorkTools();

    if (!$dbwTools->isToolAllowed($user->getIdentifier(), $this->getToolId())) {
      return false;
    }

    return true;
  }

  public function action()
  {
    $this->response->bankdaten = \BankDatenOperations::getBankdatenAnhandIban($this->request->iban);

    return $this->response;
  }
}

class BankdatenAnhandIbanRequest
{
  public $iban;
}

class BankdatenAnhandIbanResponse extends \Kufer\KuferTools\Basis\UseCase\ToolResponse
{
  public $bankdaten;
}