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

namespace Kufer\Web\KuferTools\Basis\UseCaseBuilder;


class HandleWithUserAndToolAction extends HandleAction implements ToolSection, ToolsAndUserUtils
{
  
  public $toolSection;

  
  public $user;

  
  public $utils;

  
  public function __construct(
    object $request,
    object $response,
    ToolSection $toolSection,
    \Benutzer $user,
    ToolsAndUserUtils $toolsAndUserUtils
  ) {
    parent::__construct($request, $response);

    $this->toolSection = $toolSection;
    $this->user = $user;
    $this->utils = $toolsAndUserUtils;
  }

  public function getToolId(): int
  {
    return $this->toolSection->getToolId();
  }

  public function getToolSectionId(): int
  {
    return $this->toolSection->getToolSectionId();
  }

  public function hasToolAccess(?int $toolSectionId = null): bool
  {
    return $this->utils->hasToolAccess($toolSectionId);
  }

  public function queryRecht(string $recht, ?int $toolId = null): int
  {
    return $this->utils->hasRecht($recht, $toolId);
  }

  public function hasRecht(string $recht, ?int $toolId = null): bool
  {
    return $this->utils->hasRecht($recht, $toolId);
  }
}