<?php

namespace Symfony\Config;

require_once __DIR__.\DIRECTORY_SEPARATOR.'CoopTilleulsForgotPassword'.\DIRECTORY_SEPARATOR.'ProvidersConfig.php';

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

/**
 * This class is automatically generated to help in creating a config.
 */
class CoopTilleulsForgotPasswordConfig implements \Symfony\Component\Config\Builder\ConfigBuilderInterface
{
    private $providers;
    private $useJmsSerializer;
    private $tokenGenerator;
    private $_usedProperties = [];
    private $_hasDeprecatedCalls = false;

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

        return $this->providers[$name];
    }

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

        return $this;
    }

    /**
     * Persistence manager service to handle the token storage.
     * @default 'coop_tilleuls_forgot_password.token_generator.bin2hex'
     * @param ParamConfigurator|mixed $value
     * @return $this
     * @deprecated since Symfony 7.4
     */
    public function tokenGenerator($value): static
    {
        $this->_hasDeprecatedCalls = true;
        $this->_usedProperties['tokenGenerator'] = true;
        $this->tokenGenerator = $value;

        return $this;
    }

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

    public function __construct(array $config = [])
    {
        if (array_key_exists('providers', $config)) {
            $this->_usedProperties['providers'] = true;
            $this->providers = array_map(fn ($v) => new \Symfony\Config\CoopTilleulsForgotPassword\ProvidersConfig($v), $config['providers']);
            unset($config['providers']);
        }

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

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

        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['providers'])) {
            $output['providers'] = array_map(fn ($v) => $v->toArray(), $this->providers);
        }
        if (isset($this->_usedProperties['useJmsSerializer'])) {
            $output['use_jms_serializer'] = $this->useJmsSerializer;
        }
        if (isset($this->_usedProperties['tokenGenerator'])) {
            $output['token_generator'] = $this->tokenGenerator;
        }
        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;
    }

}
