<?php

namespace Symfony\Config;

require_once __DIR__.\DIRECTORY_SEPARATOR.'Lti1p3'.\DIRECTORY_SEPARATOR.'KeyChainConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'Lti1p3'.\DIRECTORY_SEPARATOR.'PlatformConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'Lti1p3'.\DIRECTORY_SEPARATOR.'ToolConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'Lti1p3'.\DIRECTORY_SEPARATOR.'RegistrationConfig.php';

use Symfony\Component\Config\Loader\ParamConfigurator;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;


/**
 * This class is automatically generated to help creating config.
 *
 * @experimental in 5.3
 */
class Lti1p3Config implements \Symfony\Component\Config\Builder\ConfigBuilderInterface
{
    private $scopes;
    private $keyChains;
    private $platforms;
    private $tools;
    private $registrations;
    
    /**
     * @param ParamConfigurator|list<mixed|ParamConfigurator> $value
     * @return $this
     */
    public function scopes($value): self
    {
        $this->scopes = $value;
    
        return $this;
    }
    
    public function keyChain(string $identifier, array $value = []): \Symfony\Config\Lti1p3\KeyChainConfig
    {
        if (!isset($this->keyChains[$identifier])) {
            return $this->keyChains[$identifier] = new \Symfony\Config\Lti1p3\KeyChainConfig($value);
        }
        if ([] === $value) {
            return $this->keyChains[$identifier];
        }
    
        throw new InvalidConfigurationException('The node created by "keyChain()" has already been initialized. You cannot pass values the second time you call keyChain().');
    }
    
    public function platform(string $identifier, array $value = []): \Symfony\Config\Lti1p3\PlatformConfig
    {
        if (!isset($this->platforms[$identifier])) {
            return $this->platforms[$identifier] = new \Symfony\Config\Lti1p3\PlatformConfig($value);
        }
        if ([] === $value) {
            return $this->platforms[$identifier];
        }
    
        throw new InvalidConfigurationException('The node created by "platform()" has already been initialized. You cannot pass values the second time you call platform().');
    }
    
    public function tool(string $identifier, array $value = []): \Symfony\Config\Lti1p3\ToolConfig
    {
        if (!isset($this->tools[$identifier])) {
            return $this->tools[$identifier] = new \Symfony\Config\Lti1p3\ToolConfig($value);
        }
        if ([] === $value) {
            return $this->tools[$identifier];
        }
    
        throw new InvalidConfigurationException('The node created by "tool()" has already been initialized. You cannot pass values the second time you call tool().');
    }
    
    public function registration(string $identifier, array $value = []): \Symfony\Config\Lti1p3\RegistrationConfig
    {
        if (!isset($this->registrations[$identifier])) {
            return $this->registrations[$identifier] = new \Symfony\Config\Lti1p3\RegistrationConfig($value);
        }
        if ([] === $value) {
            return $this->registrations[$identifier];
        }
    
        throw new InvalidConfigurationException('The node created by "registration()" has already been initialized. You cannot pass values the second time you call registration().');
    }
    
    public function getExtensionAlias(): string
    {
        return 'lti1p3';
    }
            
    
    public function __construct(array $value = [])
    {
    
        if (isset($value['scopes'])) {
            $this->scopes = $value['scopes'];
            unset($value['scopes']);
        }
    
        if (isset($value['key_chains'])) {
            $this->keyChains = array_map(function ($v) { return new \Symfony\Config\Lti1p3\KeyChainConfig($v); }, $value['key_chains']);
            unset($value['key_chains']);
        }
    
        if (isset($value['platforms'])) {
            $this->platforms = array_map(function ($v) { return new \Symfony\Config\Lti1p3\PlatformConfig($v); }, $value['platforms']);
            unset($value['platforms']);
        }
    
        if (isset($value['tools'])) {
            $this->tools = array_map(function ($v) { return new \Symfony\Config\Lti1p3\ToolConfig($v); }, $value['tools']);
            unset($value['tools']);
        }
    
        if (isset($value['registrations'])) {
            $this->registrations = array_map(function ($v) { return new \Symfony\Config\Lti1p3\RegistrationConfig($v); }, $value['registrations']);
            unset($value['registrations']);
        }
    
        if ([] !== $value) {
            throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($value)));
        }
    }
    
    
    public function toArray(): array
    {
        $output = [];
        if (null !== $this->scopes) {
            $output['scopes'] = $this->scopes;
        }
        if (null !== $this->keyChains) {
            $output['key_chains'] = array_map(function ($v) { return $v->toArray(); }, $this->keyChains);
        }
        if (null !== $this->platforms) {
            $output['platforms'] = array_map(function ($v) { return $v->toArray(); }, $this->platforms);
        }
        if (null !== $this->tools) {
            $output['tools'] = array_map(function ($v) { return $v->toArray(); }, $this->tools);
        }
        if (null !== $this->registrations) {
            $output['registrations'] = array_map(function ($v) { return $v->toArray(); }, $this->registrations);
        }
    
        return $output;
    }
    

}
