<?php

namespace Symfony\Config;

require_once __DIR__.\DIRECTORY_SEPARATOR.'Mcp'.\DIRECTORY_SEPARATOR.'IconsConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'Mcp'.\DIRECTORY_SEPARATOR.'ClientTransportsConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'Mcp'.\DIRECTORY_SEPARATOR.'DiscoveryConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'Mcp'.\DIRECTORY_SEPARATOR.'HttpConfig.php';

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

/**
 * This class is automatically generated to help in creating a config.
 */
class McpConfig implements \Symfony\Component\Config\Builder\ConfigBuilderInterface
{
    private $app;
    private $version;
    private $description;
    private $icons;
    private $websiteUrl;
    private $paginationLimit;
    private $instructions;
    private $clientTransports;
    private $discovery;
    private $http;
    private $_usedProperties = [];
    private $_hasDeprecatedCalls = false;

    /**
     * @default 'app'
     * @param ParamConfigurator|mixed $value
     * @return $this
     * @deprecated since Symfony 7.4
     */
    public function app($value): static
    {
        $this->_hasDeprecatedCalls = true;
        $this->_usedProperties['app'] = true;
        $this->app = $value;

        return $this;
    }

    /**
     * @default '0.0.1'
     * @param ParamConfigurator|mixed $value
     * @return $this
     * @deprecated since Symfony 7.4
     */
    public function version($value): static
    {
        $this->_hasDeprecatedCalls = true;
        $this->_usedProperties['version'] = true;
        $this->version = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     * @deprecated since Symfony 7.4
     */
    public function description($value): static
    {
        $this->_hasDeprecatedCalls = true;
        $this->_usedProperties['description'] = true;
        $this->description = $value;

        return $this;
    }

    /**
     * @deprecated since Symfony 7.4
     */
    public function icons(array $value = []): \Symfony\Config\Mcp\IconsConfig
    {
        $this->_hasDeprecatedCalls = true;
        $this->_usedProperties['icons'] = true;

        return $this->icons[] = new \Symfony\Config\Mcp\IconsConfig($value);
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     * @deprecated since Symfony 7.4
     */
    public function websiteUrl($value): static
    {
        $this->_hasDeprecatedCalls = true;
        $this->_usedProperties['websiteUrl'] = true;
        $this->websiteUrl = $value;

        return $this;
    }

    /**
     * @default 50
     * @param ParamConfigurator|int $value
     * @return $this
     * @deprecated since Symfony 7.4
     */
    public function paginationLimit($value): static
    {
        $this->_hasDeprecatedCalls = true;
        $this->_usedProperties['paginationLimit'] = true;
        $this->paginationLimit = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     * @deprecated since Symfony 7.4
     */
    public function instructions($value): static
    {
        $this->_hasDeprecatedCalls = true;
        $this->_usedProperties['instructions'] = true;
        $this->instructions = $value;

        return $this;
    }

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

        return $this->clientTransports;
    }

    /**
     * @default {"scan_dirs":["src"],"exclude_dirs":[]}
     * @deprecated since Symfony 7.4
     */
    public function discovery(array $value = []): \Symfony\Config\Mcp\DiscoveryConfig
    {
        $this->_hasDeprecatedCalls = true;
        if (null === $this->discovery) {
            $this->_usedProperties['discovery'] = true;
            $this->discovery = new \Symfony\Config\Mcp\DiscoveryConfig($value);
        } elseif (0 < \func_num_args()) {
            throw new InvalidConfigurationException('The node created by "discovery()" has already been initialized. You cannot pass values the second time you call discovery().');
        }

        return $this->discovery;
    }

    /**
     * @default {"path":"\/_mcp","session":{"store":"file","directory":"%kernel.cache_dir%\/mcp-sessions","ttl":3600}}
     * @deprecated since Symfony 7.4
     */
    public function http(array $value = []): \Symfony\Config\Mcp\HttpConfig
    {
        $this->_hasDeprecatedCalls = true;
        if (null === $this->http) {
            $this->_usedProperties['http'] = true;
            $this->http = new \Symfony\Config\Mcp\HttpConfig($value);
        } elseif (0 < \func_num_args()) {
            throw new InvalidConfigurationException('The node created by "http()" has already been initialized. You cannot pass values the second time you call http().');
        }

        return $this->http;
    }

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

    public function __construct(array $config = [])
    {
        if (array_key_exists('app', $config)) {
            $this->_usedProperties['app'] = true;
            $this->app = $config['app'];
            unset($config['app']);
        }

        if (array_key_exists('version', $config)) {
            $this->_usedProperties['version'] = true;
            $this->version = $config['version'];
            unset($config['version']);
        }

        if (array_key_exists('description', $config)) {
            $this->_usedProperties['description'] = true;
            $this->description = $config['description'];
            unset($config['description']);
        }

        if (array_key_exists('icons', $config)) {
            $this->_usedProperties['icons'] = true;
            $this->icons = array_map(fn ($v) => new \Symfony\Config\Mcp\IconsConfig($v), $config['icons']);
            unset($config['icons']);
        }

        if (array_key_exists('website_url', $config)) {
            $this->_usedProperties['websiteUrl'] = true;
            $this->websiteUrl = $config['website_url'];
            unset($config['website_url']);
        }

        if (array_key_exists('pagination_limit', $config)) {
            $this->_usedProperties['paginationLimit'] = true;
            $this->paginationLimit = $config['pagination_limit'];
            unset($config['pagination_limit']);
        }

        if (array_key_exists('instructions', $config)) {
            $this->_usedProperties['instructions'] = true;
            $this->instructions = $config['instructions'];
            unset($config['instructions']);
        }

        if (array_key_exists('client_transports', $config)) {
            $this->_usedProperties['clientTransports'] = true;
            $this->clientTransports = new \Symfony\Config\Mcp\ClientTransportsConfig($config['client_transports']);
            unset($config['client_transports']);
        }

        if (array_key_exists('discovery', $config)) {
            $this->_usedProperties['discovery'] = true;
            $this->discovery = new \Symfony\Config\Mcp\DiscoveryConfig($config['discovery']);
            unset($config['discovery']);
        }

        if (array_key_exists('http', $config)) {
            $this->_usedProperties['http'] = true;
            $this->http = new \Symfony\Config\Mcp\HttpConfig($config['http']);
            unset($config['http']);
        }

        if ($config) {
            throw new InvalidConfigurationException(sprintf('The following keys are not supported by "%s": ', __CLASS__).implode(', ', array_keys($config)));
        }
    }

    public function toArray(): array
    {
        $output = [];
        if (isset($this->_usedProperties['app'])) {
            $output['app'] = $this->app;
        }
        if (isset($this->_usedProperties['version'])) {
            $output['version'] = $this->version;
        }
        if (isset($this->_usedProperties['description'])) {
            $output['description'] = $this->description;
        }
        if (isset($this->_usedProperties['icons'])) {
            $output['icons'] = array_map(fn ($v) => $v->toArray(), $this->icons);
        }
        if (isset($this->_usedProperties['websiteUrl'])) {
            $output['website_url'] = $this->websiteUrl;
        }
        if (isset($this->_usedProperties['paginationLimit'])) {
            $output['pagination_limit'] = $this->paginationLimit;
        }
        if (isset($this->_usedProperties['instructions'])) {
            $output['instructions'] = $this->instructions;
        }
        if (isset($this->_usedProperties['clientTransports'])) {
            $output['client_transports'] = $this->clientTransports->toArray();
        }
        if (isset($this->_usedProperties['discovery'])) {
            $output['discovery'] = $this->discovery->toArray();
        }
        if (isset($this->_usedProperties['http'])) {
            $output['http'] = $this->http->toArray();
        }
        if ($this->_hasDeprecatedCalls) {
            trigger_deprecation('symfony/config', '7.4', 'Calling any fluent method on "%s" is deprecated; pass the configuration to the constructor instead.', $this::class);
        }

        return $output;
    }

}
