<?php

namespace Symfony\Config\Flysystem\StorageConfig;

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 AsyncawsConfig 
{
    private $client;
    private $bucket;
    private $prefix;
    private $_usedProperties = [];

    /**
     * The AsyncAws S3 client service name
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function client($value): static
    {
        $this->_usedProperties['client'] = true;
        $this->client = $value;

        return $this;
    }

    /**
     * The name of the AWS S3 bucket
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function bucket($value): static
    {
        $this->_usedProperties['bucket'] = true;
        $this->bucket = $value;

        return $this;
    }

    /**
     * Optional path prefix to prepend to all object keys
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function prefix($value): static
    {
        $this->_usedProperties['prefix'] = true;
        $this->prefix = $value;

        return $this;
    }

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

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

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

        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['client'])) {
            $output['client'] = $this->client;
        }
        if (isset($this->_usedProperties['bucket'])) {
            $output['bucket'] = $this->bucket;
        }
        if (isset($this->_usedProperties['prefix'])) {
            $output['prefix'] = $this->prefix;
        }

        return $output;
    }

}
