<?php

namespace Symfony\Config\SuluForm;

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 HoneypotConfig 
{
    private $field;
    private $strategy;
    private $_usedProperties = [];

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

        return $this;
    }

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

        return $this;
    }

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

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

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

        return $output;
    }

}
