<?php

namespace Symfony\Config\Mjml;

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 OptionsConfig 
{
    private $binary;
    private $node;
    private $serviceId;
    private $validationLevel;
    private $minify;
    private $mjmlVersion;
    private $_usedProperties = [];

    /**
     * Path to the MJML binary
     * @default '/usr/local/bin/mjml'
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function binary($value): static
    {
        $this->_usedProperties['binary'] = true;
        $this->binary = $value;

        return $this;
    }

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

        return $this;
    }

    /**
     * Service id when renderer is defined to "service"
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function serviceId($value): static
    {
        $this->_usedProperties['serviceId'] = true;
        $this->serviceId = $value;

        return $this;
    }

    /**
     * Validation level. See https://github.com/mjmlio/mjml/tree/master/packages/mjml-validator#validating-mjml
     * @default 'strict'
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function validationLevel($value): static
    {
        $this->_usedProperties['validationLevel'] = true;
        $this->validationLevel = $value;

        return $this;
    }

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

        return $this;
    }

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

        return $this;
    }

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

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

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

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

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

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

        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['binary'])) {
            $output['binary'] = $this->binary;
        }
        if (isset($this->_usedProperties['node'])) {
            $output['node'] = $this->node;
        }
        if (isset($this->_usedProperties['serviceId'])) {
            $output['service_id'] = $this->serviceId;
        }
        if (isset($this->_usedProperties['validationLevel'])) {
            $output['validation_level'] = $this->validationLevel;
        }
        if (isset($this->_usedProperties['minify'])) {
            $output['minify'] = $this->minify;
        }
        if (isset($this->_usedProperties['mjmlVersion'])) {
            $output['mjml_version'] = $this->mjmlVersion;
        }

        return $output;
    }

}
