<?php
namespace Claromentis\Infocapture\PluginFramework;

$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"] ?: array()) + array("_5846ddea7ff6d30bd0e7b4a817" . "10776e" => base64_decode("YXJyYXlfc2" . "hpZnQ="));
use BadMethodCallException;
use Claromentis\Infocapture\Exception\UnknownICPluginMethodException;
use Claromentis\Core\DAL;
use HDIssue;
use ICPluginCaller;


























class PluginForwarder
{
    const PLUGIN_METHOD_ARGS = ['CheckIssueRights' => ['perm', 'has'], 'CheckProjectRights' => ['perm', 'has'], 'CheckPotentialRights' => ['perm', 'has'], 'CheckHandlerRights' => ['perm', 'has'], 'CheckReporterRights' => ['perm', 'has'], 'OnFileUpload' => ['id', 'name', 'description', 'path'], 'IssuesListPermissionFilter' => ['issue_table_alias'], 'GetUsersWithAnyRights' => ['rights', 'default_list'], 'GetUsersWithAllRights' => ['rights', 'default_list']];
    const PLUGIN_METHOD_HAS_NO_ISSUE = ["IssuesListFilter" => true, "IssuesListPermissionFilter" => true, "CheckProjectRights" => true, "CheckPotentialRights" => true, "CheckHandlerRights" => true, "CheckReporterRights" => true, "GetUsersWithAnyRights" => true, "GetUsersWithAllRights" => true];
    const PLUGIN_METHOD_HAS_NO_OLD_ISSUE = ["ModifyForm" => true, "IssuesListFilter" => true, "IssuesListPermissionFilter" => true, "CheckIssueRights" => true, "CheckProjectRights" => true, "CheckPotentialRights" => true, "CheckHandlerRights" => true, "CheckReporterRights" => true, "GetUsersWithAnyRights" => true, "GetUsersWithAllRights" => true, "OnIssueDelete" => true];
    protected \HDProject $project;
    public function __construct(\HDProject $project)
    {
        $this->project = $project;
    }
    public function __call(string $name, array $arguments)
    {
        $issue = null;
        $_279e1044fce2137914e09a214fbc8fce = null;
        if (!isset(self::PLUGIN_METHOD_HAS_NO_ISSUE[$name])) {
            $issue = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_5846ddea7ff6d30bd0e7b4a81710" . "776e"]($arguments);
        }
        if (!isset(self::PLUGIN_METHOD_HAS_NO_OLD_ISSUE[$name])) {
            $_279e1044fce2137914e09a214fbc8fce = $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_5846ddea7f" . "f6d30bd0e7b" . "4a81710776e"]($arguments);
        }
        if (isset(self::PLUGIN_METHOD_ARGS[$name])) {
            $_2ee41c34a86103621a5abc33f326a11a = [];
            foreach (self::PLUGIN_METHOD_ARGS[$name] as $_02ad4799244951c2d809ee37be9e79fd => $_98f1b0ff54cabd67e8581719cec53e9b) {
                
                
                $_2ee41c34a86103621a5abc33f326a11a[$_98f1b0ff54cabd67e8581719cec53e9b] = $arguments[$_98f1b0ff54cabd67e8581719cec53e9b] ?? $arguments[$_02ad4799244951c2d809ee37be9e79fd] ?? null;
            }
        } else {
            $_2ee41c34a86103621a5abc33f326a11a = $arguments;
        }
        try {
            return ICPluginCaller::Call($name, $this->project, $issue, $_279e1044fce2137914e09a214fbc8fce, $_2ee41c34a86103621a5abc33f326a11a);
        } catch (UnknownICPluginMethodException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new BadMethodCallException($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage(), $_fe441aa3ef350bfb1a1a1ad8520dd530->getCode(), $_fe441aa3ef350bfb1a1a1ad8520dd530);
        }
    }
    
    
    
    
    
    
    
    
    
    public function IsPluginEnabled() : bool
    {
        return !ICPluginCaller::IsPluginDisabled($this->project);
    }
}