<?php

namespace Symfony\Config\Mcp\Http;

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 SessionConfig 
{
    private $store;
    private $directory;
    private $ttl;
    private $_usedProperties = [];

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

        return $this;
    }

    /**
     * @default '%kernel.cache_dir%/mcp-sessions'
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function directory($value): static
    {
        $this->_usedProperties['directory'] = true;
        $this->directory = $value;

        return $this;
    }

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

        return $this;
    }

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

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

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

        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['store'])) {
            $output['store'] = $this->store;
        }
        if (isset($this->_usedProperties['directory'])) {
            $output['directory'] = $this->directory;
        }
        if (isset($this->_usedProperties['ttl'])) {
            $output['ttl'] = $this->ttl;
        }

        return $output;
    }

}
