<?php

namespace Symfony\Config\LightSamlSymfonyBridge;

require_once __DIR__.\DIRECTORY_SEPARATOR.'Own'.\DIRECTORY_SEPARATOR.'EntityDescriptorProviderConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'Own'.\DIRECTORY_SEPARATOR.'CredentialsConfig.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 OwnConfig 
{
    private $entityId;
    private $entityDescriptorProvider;
    private $credentials;
    
    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function entityId($value): self
    {
        $this->entityId = $value;
    
        return $this;
    }
    
    public function entityDescriptorProvider(array $value = []): \Symfony\Config\LightSamlSymfonyBridge\Own\EntityDescriptorProviderConfig
    {
        if (null === $this->entityDescriptorProvider) {
            $this->entityDescriptorProvider = new \Symfony\Config\LightSamlSymfonyBridge\Own\EntityDescriptorProviderConfig($value);
        } elseif ([] !== $value) {
            throw new InvalidConfigurationException('The node created by "entityDescriptorProvider()" has already been initialized. You cannot pass values the second time you call entityDescriptorProvider().');
        }
    
        return $this->entityDescriptorProvider;
    }
    
    public function credentials(array $value = []): \Symfony\Config\LightSamlSymfonyBridge\Own\CredentialsConfig
    {
        return $this->credentials[] = new \Symfony\Config\LightSamlSymfonyBridge\Own\CredentialsConfig($value);
    }
    
    public function __construct(array $value = [])
    {
    
        if (isset($value['entity_id'])) {
            $this->entityId = $value['entity_id'];
            unset($value['entity_id']);
        }
    
        if (isset($value['entity_descriptor_provider'])) {
            $this->entityDescriptorProvider = new \Symfony\Config\LightSamlSymfonyBridge\Own\EntityDescriptorProviderConfig($value['entity_descriptor_provider']);
            unset($value['entity_descriptor_provider']);
        }
    
        if (isset($value['credentials'])) {
            $this->credentials = array_map(function ($v) { return new \Symfony\Config\LightSamlSymfonyBridge\Own\CredentialsConfig($v); }, $value['credentials']);
            unset($value['credentials']);
        }
    
        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->entityId) {
            $output['entity_id'] = $this->entityId;
        }
        if (null !== $this->entityDescriptorProvider) {
            $output['entity_descriptor_provider'] = $this->entityDescriptorProvider->toArray();
        }
        if (null !== $this->credentials) {
            $output['credentials'] = array_map(function ($v) { return $v->toArray(); }, $this->credentials);
        }
    
        return $output;
    }
    

}
