<?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 PlatformConfig 
{
    private $name;
    private $audience;
    private $oidcAuthenticationUrl;
    private $oauth2AccessTokenUrl;
    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 oidcAuthenticationUrl($value): self
    {
        $this->_usedProperties['oidcAuthenticationUrl'] = true;
        $this->oidcAuthenticationUrl = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function oauth2AccessTokenUrl($value): self
    {
        $this->_usedProperties['oauth2AccessTokenUrl'] = true;
        $this->oauth2AccessTokenUrl = $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_authentication_url', $value)) {
            $this->_usedProperties['oidcAuthenticationUrl'] = true;
            $this->oidcAuthenticationUrl = $value['oidc_authentication_url'];
            unset($value['oidc_authentication_url']);
        }

        if (array_key_exists('oauth2_access_token_url', $value)) {
            $this->_usedProperties['oauth2AccessTokenUrl'] = true;
            $this->oauth2AccessTokenUrl = $value['oauth2_access_token_url'];
            unset($value['oauth2_access_token_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['oidcAuthenticationUrl'])) {
            $output['oidc_authentication_url'] = $this->oidcAuthenticationUrl;
        }
        if (isset($this->_usedProperties['oauth2AccessTokenUrl'])) {
            $output['oauth2_access_token_url'] = $this->oauth2AccessTokenUrl;
        }

        return $output;
    }

}
