<?php

namespace Symfony\Config\Lti1p3;

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 ToolConfig 
{
    private $name;
    private $audience;
    private $oidcInitiationUrl;
    private $launchUrl;
    private $deepLinkingUrl;
    private $_usedProperties = [];

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function name($value): self
    {
        $this->_usedProperties['name'] = true;
        $this->name = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function audience($value): self
    {
        $this->_usedProperties['audience'] = true;
        $this->audience = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function oidcInitiationUrl($value): self
    {
        $this->_usedProperties['oidcInitiationUrl'] = true;
        $this->oidcInitiationUrl = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function launchUrl($value): self
    {
        $this->_usedProperties['launchUrl'] = true;
        $this->launchUrl = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function deepLinkingUrl($value): self
    {
        $this->_usedProperties['deepLinkingUrl'] = true;
        $this->deepLinkingUrl = $value;

        return $this;
    }

    public function __construct(array $value = [])
    {
        if (array_key_exists('name', $value)) {
            $this->_usedProperties['name'] = true;
            $this->name = $value['name'];
            unset($value['name']);
        }

        if (array_key_exists('audience', $value)) {
            $this->_usedProperties['audience'] = true;
            $this->audience = $value['audience'];
            unset($value['audience']);
        }

        if (array_key_exists('oidc_initiation_url', $value)) {
            $this->_usedProperties['oidcInitiationUrl'] = true;
            $this->oidcInitiationUrl = $value['oidc_initiation_url'];
            unset($value['oidc_initiation_url']);
        }

        if (array_key_exists('launch_url', $value)) {
            $this->_usedProperties['launchUrl'] = true;
            $this->launchUrl = $value['launch_url'];
            unset($value['launch_url']);
        }

        if (array_key_exists('deep_linking_url', $value)) {
            $this->_usedProperties['deepLinkingUrl'] = true;
            $this->deepLinkingUrl = $value['deep_linking_url'];
            unset($value['deep_linking_url']);
        }

        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['name'])) {
            $output['name'] = $this->name;
        }
        if (isset($this->_usedProperties['audience'])) {
            $output['audience'] = $this->audience;
        }
        if (isset($this->_usedProperties['oidcInitiationUrl'])) {
            $output['oidc_initiation_url'] = $this->oidcInitiationUrl;
        }
        if (isset($this->_usedProperties['launchUrl'])) {
            $output['launch_url'] = $this->launchUrl;
        }
        if (isset($this->_usedProperties['deepLinkingUrl'])) {
            $output['deep_linking_url'] = $this->deepLinkingUrl;
        }

        return $output;
    }

}
