namespace Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ComplexItemTyped;

use Magento\Framework\Config\ScopeInterface;
use Magento\Framework\ObjectManagerInterface;

/**
 * Interceptor class for @see \Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ComplexItemTyped
 */
class Interceptor extends \Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ComplexItemTyped
{
    /**
     * @var ScopeInterface
     */
    private $____scope = null;

    /**
     * @var ObjectManagerInterface
     */
    private $____om = null;

    /**
     * @var \Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ItemPlugin\Complex
     */
    private $____plugin_complex_plugin = null;

    /**
     * @var \Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ItemPlugin\Advanced
     */
    private $____plugin_advanced_plugin = null;

    /**
     * {@inheritdoc}
     */
    public function __construct(\Magento\Framework\ObjectManagerInterface $____om, \Magento\Framework\Config\ScopeInterface $____scope)
    {
        $this->____om = $____om;
        $this->____scope = $____scope;
    }

    /**
     * {@inheritdoc}
     */
    public function returnVoid() : void
    {
        switch ($this->____scope->getCurrentScope()) {
        	case 'backend':
        		parent::returnVoid();
        		
        		$this->____plugin_complex_plugin()->afterReturnVoid($this, null);
        		break;
        	default:
        		parent::returnVoid();
        		break;
        }
    }

    /**
     * {@inheritdoc}
     */
    public function getNullableValue() : ?string
    {
        switch ($this->____scope->getCurrentScope()) {
        	case 'backend':
        		$result = parent::getNullableValue();
        		
        		return (($tmp = $this->____plugin_complex_plugin()->afterGetNullableValue($this, $result)) !== null) ? $tmp : $result;
        	default:
        		return parent::getNullableValue();
        }
    }

    /**
     * {@inheritdoc}
     */
    public function getName() : string
    {
        switch ($this->____scope->getCurrentScope()) {
        	case 'backend':
        		$this->____plugin_advanced_plugin()->beforeGetName($this);
        		
        		$result = $this->____plugin_advanced_plugin()->aroundGetName($this, function(){
        			$result = $this->____plugin_complex_plugin()->aroundGetName($this, function(){
        				return parent::getName();
        			});
        			
        			return (($tmp = $this->____plugin_complex_plugin()->afterGetName($this, $result)) !== null) ? $tmp : $result;
        		});
        		
        		return (($tmp = $this->____plugin_advanced_plugin()->afterGetName($this, $result)) !== null) ? $tmp : $result;
        	default:
        		return parent::getName();
        }
    }

    /**
     * {@inheritdoc}
     */
    public function setValue(string $value)
    {
        switch ($this->____scope->getCurrentScope()) {
        	case 'backend':
        		$beforeResult = $this->____plugin_complex_plugin()->beforeSetValue($this, $value);
        		if ($beforeResult !== null) list($value) = (array)$beforeResult;
        		
        		return $this->____plugin_complex_plugin()->aroundSetValue($this, function($value){
        			return parent::setValue($value);
        		}, $value);
        	default:
        		return parent::setValue($value);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function firstVariadicParameter(string ... $variadicValue)
    {
        switch ($this->____scope->getCurrentScope()) {
        	case 'backend':
        		return $this->____plugin_complex_plugin()->aroundFirstVariadicParameter($this, function($variadicValue){
        			return parent::firstVariadicParameter($variadicValue);
        		}, $variadicValue);
        	default:
        		return parent::firstVariadicParameter($variadicValue);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function secondVariadicParameter(string $value, string ... $variadicValue)
    {
        switch ($this->____scope->getCurrentScope()) {
        	case 'backend':
        		return $this->____plugin_complex_plugin()->aroundSecondVariadicParameter($this, function($value, $variadicValue){
        			return parent::secondVariadicParameter($value, $variadicValue);
        		}, $value, $variadicValue);
        	default:
        		return parent::secondVariadicParameter($value, $variadicValue);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function byRefVariadic(string &... $variadicValue)
    {
        switch ($this->____scope->getCurrentScope()) {
        	case 'backend':
        		return $this->____plugin_complex_plugin()->aroundByRefVariadic($this, function(&$variadicValue){
        			return parent::byRefVariadic($variadicValue);
        		}, $variadicValue);
        	default:
        		return parent::byRefVariadic($variadicValue);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function returnsSelf() : \Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ComplexItemTyped
    {
        switch ($this->____scope->getCurrentScope()) {
        	case 'backend':
        		$this->____plugin_complex_plugin()->beforeReturnsSelf($this);
        		
        		return parent::returnsSelf();
        	default:
        		return parent::returnsSelf();
        }
    }

    /**
     * {@inheritdoc}
     */
    public function returnsType() : \Magento\Framework\Something
    {
        switch ($this->____scope->getCurrentScope()) {
        	case 'backend':
        		$this->____plugin_complex_plugin()->beforeReturnsType($this);
        		
        		return parent::returnsType();
        	default:
        		return parent::returnsType();
        }
    }

    /**
     * plugin "complex_plugin"
     * @return \Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ItemPlugin\Complex
     */
    private function ____plugin_complex_plugin() : \Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ItemPlugin\Complex
    {
        if ($this->____plugin_complex_plugin === null) {
        	$this->____plugin_complex_plugin = $this->____om->get(\Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ItemPlugin\Complex::class);
        }
        return $this->____plugin_complex_plugin;
    }

    /**
     * plugin "advanced_plugin"
     * @return \Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ItemPlugin\Advanced
     */
    private function ____plugin_advanced_plugin() : \Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ItemPlugin\Advanced
    {
        if ($this->____plugin_advanced_plugin === null) {
        	$this->____plugin_advanced_plugin = $this->____om->get(\Creatuity\Interception\Test\Integration\CompiledInterceptor\Custom\Module\Model\ItemPlugin\Advanced::class);
        }
        return $this->____plugin_advanced_plugin;
    }
}
