<?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 KeyChainConfig 
{
    private $keySetName;
    private $publicKey;
    private $privateKey;
    private $privateKeyPassphrase;
    private $algorithm;
    private $_usedProperties = [];

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function keySetName($value): self
    {
        $this->_usedProperties['keySetName'] = true;
        $this->keySetName = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function publicKey($value): self
    {
        $this->_usedProperties['publicKey'] = true;
        $this->publicKey = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function privateKey($value): self
    {
        $this->_usedProperties['privateKey'] = true;
        $this->privateKey = $value;

        return $this;
    }

    /**
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function privateKeyPassphrase($value): self
    {
        $this->_usedProperties['privateKeyPassphrase'] = true;
        $this->privateKeyPassphrase = $value;

        return $this;
    }

    /**
     * @default 'RS256'
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function algorithm($value): self
    {
        $this->_usedProperties['algorithm'] = true;
        $this->algorithm = $value;

        return $this;
    }

    public function __construct(array $value = [])
    {
        if (array_key_exists('key_set_name', $value)) {
            $this->_usedProperties['keySetName'] = true;
            $this->keySetName = $value['key_set_name'];
            unset($value['key_set_name']);
        }

        if (array_key_exists('public_key', $value)) {
            $this->_usedProperties['publicKey'] = true;
            $this->publicKey = $value['public_key'];
            unset($value['public_key']);
        }

        if (array_key_exists('private_key', $value)) {
            $this->_usedProperties['privateKey'] = true;
            $this->privateKey = $value['private_key'];
            unset($value['private_key']);
        }

        if (array_key_exists('private_key_passphrase', $value)) {
            $this->_usedProperties['privateKeyPassphrase'] = true;
            $this->privateKeyPassphrase = $value['private_key_passphrase'];
            unset($value['private_key_passphrase']);
        }

        if (array_key_exists('algorithm', $value)) {
            $this->_usedProperties['algorithm'] = true;
            $this->algorithm = $value['algorithm'];
            unset($value['algorithm']);
        }

        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['keySetName'])) {
            $output['key_set_name'] = $this->keySetName;
        }
        if (isset($this->_usedProperties['publicKey'])) {
            $output['public_key'] = $this->publicKey;
        }
        if (isset($this->_usedProperties['privateKey'])) {
            $output['private_key'] = $this->privateKey;
        }
        if (isset($this->_usedProperties['privateKeyPassphrase'])) {
            $output['private_key_passphrase'] = $this->privateKeyPassphrase;
        }
        if (isset($this->_usedProperties['algorithm'])) {
            $output['algorithm'] = $this->algorithm;
        }

        return $output;
    }

}
