<?php

namespace Symfony\Config\AkeneoElasticsearch;

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 IndexesConfig 
{
    private $indexName;
    private $configurationFiles;
    private $serviceName;
    private $idPrefix;
    private $activateDualIndexationWithService;
    private $_usedProperties = [];

    /**
     * An index name.
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function indexName($value): self
    {
        $this->_usedProperties['indexName'] = true;
        $this->indexName = $value;

        return $this;
    }

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

        return $this;
    }

    /**
     * Name of the symfony service for this client that will be automatically registered in the symfony container.
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function serviceName($value): self
    {
        $this->_usedProperties['serviceName'] = true;
        $this->serviceName = $value;

        return $this;
    }

    /**
     * Prefix all document ids
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function idPrefix($value): self
    {
        $this->_usedProperties['idPrefix'] = true;
        $this->idPrefix = $value;

        return $this;
    }

    /**
     * Activate dual indexation using the specified service as value
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function activateDualIndexationWithService($value): self
    {
        $this->_usedProperties['activateDualIndexationWithService'] = true;
        $this->activateDualIndexationWithService = $value;

        return $this;
    }

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

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

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

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

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

        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['indexName'])) {
            $output['index_name'] = $this->indexName;
        }
        if (isset($this->_usedProperties['configurationFiles'])) {
            $output['configuration_files'] = $this->configurationFiles;
        }
        if (isset($this->_usedProperties['serviceName'])) {
            $output['service_name'] = $this->serviceName;
        }
        if (isset($this->_usedProperties['idPrefix'])) {
            $output['id_prefix'] = $this->idPrefix;
        }
        if (isset($this->_usedProperties['activateDualIndexationWithService'])) {
            $output['activate_dual_indexation_with_service'] = $this->activateDualIndexationWithService;
        }

        return $output;
    }

}
