<?php

namespace Symfony\Config;

require_once __DIR__.\DIRECTORY_SEPARATOR.'SuluHeadless'.\DIRECTORY_SEPARATOR.'NavigationConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'SuluHeadless'.\DIRECTORY_SEPARATOR.'SnippetAreaConfig.php';

use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;

/**
 * This class is automatically generated to help in creating a config.
 */
class SuluHeadlessConfig implements \Symfony\Component\Config\Builder\ConfigBuilderInterface
{
    private $navigation;
    private $snippetArea;
    private $_usedProperties = [];

    /**
     * @default {"cache_lifetime":86400}
    */
    public function navigation(array $value = []): \Symfony\Config\SuluHeadless\NavigationConfig
    {
        if (null === $this->navigation) {
            $this->_usedProperties['navigation'] = true;
            $this->navigation = new \Symfony\Config\SuluHeadless\NavigationConfig($value);
        } elseif (0 < \func_num_args()) {
            throw new InvalidConfigurationException('The node created by "navigation()" has already been initialized. You cannot pass values the second time you call navigation().');
        }

        return $this->navigation;
    }

    /**
     * @default {"cache_lifetime":86400}
    */
    public function snippetArea(array $value = []): \Symfony\Config\SuluHeadless\SnippetAreaConfig
    {
        if (null === $this->snippetArea) {
            $this->_usedProperties['snippetArea'] = true;
            $this->snippetArea = new \Symfony\Config\SuluHeadless\SnippetAreaConfig($value);
        } elseif (0 < \func_num_args()) {
            throw new InvalidConfigurationException('The node created by "snippetArea()" has already been initialized. You cannot pass values the second time you call snippetArea().');
        }

        return $this->snippetArea;
    }

    public function getExtensionAlias(): string
    {
        return 'sulu_headless';
    }

    public function __construct(array $value = [])
    {
        if (array_key_exists('navigation', $value)) {
            $this->_usedProperties['navigation'] = true;
            $this->navigation = new \Symfony\Config\SuluHeadless\NavigationConfig($value['navigation']);
            unset($value['navigation']);
        }

        if (array_key_exists('snippet_area', $value)) {
            $this->_usedProperties['snippetArea'] = true;
            $this->snippetArea = new \Symfony\Config\SuluHeadless\SnippetAreaConfig($value['snippet_area']);
            unset($value['snippet_area']);
        }

        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 (isset($this->_usedProperties['navigation'])) {
            $output['navigation'] = $this->navigation->toArray();
        }
        if (isset($this->_usedProperties['snippetArea'])) {
            $output['snippet_area'] = $this->snippetArea->toArray();
        }

        return $output;
    }

}
