<?php

namespace Symfony\Config;

require_once __DIR__.\DIRECTORY_SEPARATOR.'Mjml'.\DIRECTORY_SEPARATOR.'OptionsConfig.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 MjmlConfig implements \Symfony\Component\Config\Builder\ConfigBuilderInterface
{
    private $renderer;
    private $options;
    private $_usedProperties = [];
    private $_hasDeprecatedCalls = false;

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

        return $this;
    }

    /**
     * @default {"binary":"\/usr\/local\/bin\/mjml","node":null,"validation_level":"strict","minify":false,"mjml_version":null}
     * @deprecated since Symfony 7.4
     */
    public function options(array $value = []): \Symfony\Config\Mjml\OptionsConfig
    {
        $this->_hasDeprecatedCalls = true;
        if (null === $this->options) {
            $this->_usedProperties['options'] = true;
            $this->options = new \Symfony\Config\Mjml\OptionsConfig($value);
        } elseif (0 < \func_num_args()) {
            throw new InvalidConfigurationException('The node created by "options()" has already been initialized. You cannot pass values the second time you call options().');
        }

        return $this->options;
    }

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

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

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

        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['renderer'])) {
            $output['renderer'] = $this->renderer;
        }
        if (isset($this->_usedProperties['options'])) {
            $output['options'] = $this->options->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;
    }

}
