<?php

namespace Symfony\Config;

require_once __DIR__.\DIRECTORY_SEPARATOR.'SuluForm'.\DIRECTORY_SEPARATOR.'MediaConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'SuluForm'.\DIRECTORY_SEPARATOR.'StaticFormsConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'SuluForm'.\DIRECTORY_SEPARATOR.'MailConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'SuluForm'.\DIRECTORY_SEPARATOR.'DynamicListBuilderConfig.php';
require_once __DIR__.\DIRECTORY_SEPARATOR.'SuluForm'.\DIRECTORY_SEPARATOR.'HoneypotConfig.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 SuluFormConfig implements \Symfony\Component\Config\Builder\ConfigBuilderInterface
{
    private $csrfProtection;
    private $sendinblueApiKey;
    private $mailchimpApiKey;
    private $mailchimpSubscribeStatus;
    private $mediaCollectionStrategy;
    private $media;
    private $staticForms;
    private $mail;
    private $dynamicListBuilder;
    private $dynamicAutoTitle;
    private $dynamicWidths;
    private $dynamicLists;
    private $ajaxTemplates;
    private $honeypot;
    private $dynamicDisabledTypes;
    private $_usedProperties = [];

    /**
     * Enable csrf protection for dynamic forms.
     * @default false
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function csrfProtection($value): static
    {
        $this->_usedProperties['csrfProtection'] = true;
        $this->csrfProtection = $value;

        return $this;
    }

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

        return $this;
    }

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

        return $this;
    }

    /**
     * @default 'subscribed'
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function mailchimpSubscribeStatus($value): static
    {
        $this->_usedProperties['mailchimpSubscribeStatus'] = true;
        $this->mailchimpSubscribeStatus = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|NULL|'single'|'tree' $value
     * @deprecated The child node "media_collection_strategy" at path "sulu_form" is deprecated.
     * @return $this
     */
    public function mediaCollectionStrategy($value): static
    {
        $this->_usedProperties['mediaCollectionStrategy'] = true;
        $this->mediaCollectionStrategy = $value;

        return $this;
    }

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

        return $this->media;
    }

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

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

    /**
     * @default {"helper":null,"from":null,"to":null,"sender":null,"templates":{"notify":"@SuluForm\/mails\/notify.html.twig","notify_plain_text":"@SuluForm\/mails\/notify_plain_text.html.twig","customer":"@SuluForm\/mails\/customer.html.twig","customer_plain_text":"@SuluForm\/mails\/customer_plain_text.html.twig"}}
    */
    public function mail(array $value = []): \Symfony\Config\SuluForm\MailConfig
    {
        if (null === $this->mail) {
            $this->_usedProperties['mail'] = true;
            $this->mail = new \Symfony\Config\SuluForm\MailConfig($value);
        } elseif (0 < \func_num_args()) {
            throw new InvalidConfigurationException('The node created by "mail()" has already been initialized. You cannot pass values the second time you call mail().');
        }

        return $this->mail;
    }

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

        return $this->dynamicListBuilder;
    }

    /**
     * @default true
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function dynamicAutoTitle($value): static
    {
        $this->_usedProperties['dynamicAutoTitle'] = true;
        $this->dynamicAutoTitle = $value;

        return $this;
    }

    /**
     * @param ParamConfigurator|list<ParamConfigurator|mixed> $value
     *
     * @return $this
     */
    public function dynamicWidths(ParamConfigurator|array $value): static
    {
        $this->_usedProperties['dynamicWidths'] = true;
        $this->dynamicWidths = $value;

        return $this;
    }

    /**
     * @default array (
     * )
     * @param ParamConfigurator|mixed $value
     *
     * @return $this
     */
    public function dynamicLists(mixed $value = array (
    )): static
    {
        $this->_usedProperties['dynamicLists'] = true;
        $this->dynamicLists = $value;

        return $this;
    }

    /**
     * @param ParamConfigurator|list<ParamConfigurator|mixed> $value
     *
     * @return $this
     */
    public function ajaxTemplates(ParamConfigurator|array $value): static
    {
        $this->_usedProperties['ajaxTemplates'] = true;
        $this->ajaxTemplates = $value;

        return $this;
    }

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

        return $this->honeypot;
    }

    /**
     * @param ParamConfigurator|list<ParamConfigurator|mixed> $value
     *
     * @return $this
     */
    public function dynamicDisabledTypes(ParamConfigurator|array $value): static
    {
        $this->_usedProperties['dynamicDisabledTypes'] = true;
        $this->dynamicDisabledTypes = $value;

        return $this;
    }

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

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

        if (array_key_exists('sendinblue_api_key', $value)) {
            $this->_usedProperties['sendinblueApiKey'] = true;
            $this->sendinblueApiKey = $value['sendinblue_api_key'];
            unset($value['sendinblue_api_key']);
        }

        if (array_key_exists('mailchimp_api_key', $value)) {
            $this->_usedProperties['mailchimpApiKey'] = true;
            $this->mailchimpApiKey = $value['mailchimp_api_key'];
            unset($value['mailchimp_api_key']);
        }

        if (array_key_exists('mailchimp_subscribe_status', $value)) {
            $this->_usedProperties['mailchimpSubscribeStatus'] = true;
            $this->mailchimpSubscribeStatus = $value['mailchimp_subscribe_status'];
            unset($value['mailchimp_subscribe_status']);
        }

        if (array_key_exists('media_collection_strategy', $value)) {
            $this->_usedProperties['mediaCollectionStrategy'] = true;
            $this->mediaCollectionStrategy = $value['media_collection_strategy'];
            unset($value['media_collection_strategy']);
        }

        if (array_key_exists('media', $value)) {
            $this->_usedProperties['media'] = true;
            $this->media = new \Symfony\Config\SuluForm\MediaConfig($value['media']);
            unset($value['media']);
        }

        if (array_key_exists('static_forms', $value)) {
            $this->_usedProperties['staticForms'] = true;
            $this->staticForms = array_map(fn ($v) => new \Symfony\Config\SuluForm\StaticFormsConfig($v), $value['static_forms']);
            unset($value['static_forms']);
        }

        if (array_key_exists('mail', $value)) {
            $this->_usedProperties['mail'] = true;
            $this->mail = new \Symfony\Config\SuluForm\MailConfig($value['mail']);
            unset($value['mail']);
        }

        if (array_key_exists('dynamic_list_builder', $value)) {
            $this->_usedProperties['dynamicListBuilder'] = true;
            $this->dynamicListBuilder = new \Symfony\Config\SuluForm\DynamicListBuilderConfig($value['dynamic_list_builder']);
            unset($value['dynamic_list_builder']);
        }

        if (array_key_exists('dynamic_auto_title', $value)) {
            $this->_usedProperties['dynamicAutoTitle'] = true;
            $this->dynamicAutoTitle = $value['dynamic_auto_title'];
            unset($value['dynamic_auto_title']);
        }

        if (array_key_exists('dynamic_widths', $value)) {
            $this->_usedProperties['dynamicWidths'] = true;
            $this->dynamicWidths = $value['dynamic_widths'];
            unset($value['dynamic_widths']);
        }

        if (array_key_exists('dynamic_lists', $value)) {
            $this->_usedProperties['dynamicLists'] = true;
            $this->dynamicLists = $value['dynamic_lists'];
            unset($value['dynamic_lists']);
        }

        if (array_key_exists('ajax_templates', $value)) {
            $this->_usedProperties['ajaxTemplates'] = true;
            $this->ajaxTemplates = $value['ajax_templates'];
            unset($value['ajax_templates']);
        }

        if (array_key_exists('honeypot', $value)) {
            $this->_usedProperties['honeypot'] = true;
            $this->honeypot = new \Symfony\Config\SuluForm\HoneypotConfig($value['honeypot']);
            unset($value['honeypot']);
        }

        if (array_key_exists('dynamic_disabled_types', $value)) {
            $this->_usedProperties['dynamicDisabledTypes'] = true;
            $this->dynamicDisabledTypes = $value['dynamic_disabled_types'];
            unset($value['dynamic_disabled_types']);
        }

        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['csrfProtection'])) {
            $output['csrf_protection'] = $this->csrfProtection;
        }
        if (isset($this->_usedProperties['sendinblueApiKey'])) {
            $output['sendinblue_api_key'] = $this->sendinblueApiKey;
        }
        if (isset($this->_usedProperties['mailchimpApiKey'])) {
            $output['mailchimp_api_key'] = $this->mailchimpApiKey;
        }
        if (isset($this->_usedProperties['mailchimpSubscribeStatus'])) {
            $output['mailchimp_subscribe_status'] = $this->mailchimpSubscribeStatus;
        }
        if (isset($this->_usedProperties['mediaCollectionStrategy'])) {
            $output['media_collection_strategy'] = $this->mediaCollectionStrategy;
        }
        if (isset($this->_usedProperties['media'])) {
            $output['media'] = $this->media->toArray();
        }
        if (isset($this->_usedProperties['staticForms'])) {
            $output['static_forms'] = array_map(fn ($v) => $v->toArray(), $this->staticForms);
        }
        if (isset($this->_usedProperties['mail'])) {
            $output['mail'] = $this->mail->toArray();
        }
        if (isset($this->_usedProperties['dynamicListBuilder'])) {
            $output['dynamic_list_builder'] = $this->dynamicListBuilder->toArray();
        }
        if (isset($this->_usedProperties['dynamicAutoTitle'])) {
            $output['dynamic_auto_title'] = $this->dynamicAutoTitle;
        }
        if (isset($this->_usedProperties['dynamicWidths'])) {
            $output['dynamic_widths'] = $this->dynamicWidths;
        }
        if (isset($this->_usedProperties['dynamicLists'])) {
            $output['dynamic_lists'] = $this->dynamicLists;
        }
        if (isset($this->_usedProperties['ajaxTemplates'])) {
            $output['ajax_templates'] = $this->ajaxTemplates;
        }
        if (isset($this->_usedProperties['honeypot'])) {
            $output['honeypot'] = $this->honeypot->toArray();
        }
        if (isset($this->_usedProperties['dynamicDisabledTypes'])) {
            $output['dynamic_disabled_types'] = $this->dynamicDisabledTypes;
        }

        return $output;
    }

}
