<?php

namespace Symfony\Config\MisdPhoneNumber;

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 ValidatorConfig 
{
    private $enabled;
    private $defaultRegion;
    private $format;
    private $_usedProperties = [];

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

        return $this;
    }

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

        return $this;
    }

    /**
     * @default \libphonenumber\PhoneNumberFormat::INTERNATIONAL
     * @param ParamConfigurator|\libphonenumber\PhoneNumberFormat::E164|\libphonenumber\PhoneNumberFormat::INTERNATIONAL|\libphonenumber\PhoneNumberFormat::NATIONAL|\libphonenumber\PhoneNumberFormat::RFC3966 $value
     * @return $this
     */
    public function format($value): static
    {
        $this->_usedProperties['format'] = true;
        $this->format = $value;

        return $this;
    }

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

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

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

        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['enabled'])) {
            $output['enabled'] = $this->enabled;
        }
        if (isset($this->_usedProperties['defaultRegion'])) {
            $output['default_region'] = $this->defaultRegion;
        }
        if (isset($this->_usedProperties['format'])) {
            $output['format'] = $this->format;
        }

        return $output;
    }

}
