<?php

namespace Symfony\Config\SuluForm;

require_once __DIR__.\DIRECTORY_SEPARATOR.'Mail'.\DIRECTORY_SEPARATOR.'TemplatesConfig.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 MailConfig 
{
    private $helper;
    private $from;
    private $to;
    private $sender;
    private $templates;
    private $_usedProperties = [];

    /**
     * Shipped helper are "swift_mailer" and "mailer", defaults to "swift_mailer" if both exists.
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function helper($value): static
    {
        $this->_usedProperties['helper'] = true;
        $this->helper = $value;

        return $this;
    }

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

        return $this;
    }

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

        return $this;
    }

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

        return $this;
    }

    /**
     * @default {"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 templates(array $value = []): \Symfony\Config\SuluForm\Mail\TemplatesConfig
    {
        if (null === $this->templates) {
            $this->_usedProperties['templates'] = true;
            $this->templates = new \Symfony\Config\SuluForm\Mail\TemplatesConfig($value);
        } elseif (0 < \func_num_args()) {
            throw new InvalidConfigurationException('The node created by "templates()" has already been initialized. You cannot pass values the second time you call templates().');
        }

        return $this->templates;
    }

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

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

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

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

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

        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['helper'])) {
            $output['helper'] = $this->helper;
        }
        if (isset($this->_usedProperties['from'])) {
            $output['from'] = $this->from;
        }
        if (isset($this->_usedProperties['to'])) {
            $output['to'] = $this->to;
        }
        if (isset($this->_usedProperties['sender'])) {
            $output['sender'] = $this->sender;
        }
        if (isset($this->_usedProperties['templates'])) {
            $output['templates'] = $this->templates->toArray();
        }

        return $output;
    }

}
