<?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 GcloudConfig 
{
    private $client;
    private $bucket;
    private $prefix;
    private $visibilityHandler;
    private $streamReads;
    private $_usedProperties = [];

    /**
     * The Google Cloud Storage 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 Google Cloud Storage 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;
    }

    /**
     * Optional visibility handler service name
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function visibilityHandler($value): static
    {
        $this->_usedProperties['visibilityHandler'] = true;
        $this->visibilityHandler = $value;

        return $this;
    }

    /**
     * Whether to use streaming for file reads
     * @default false
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function streamReads($value): static
    {
        $this->_usedProperties['streamReads'] = true;
        $this->streamReads = $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 (array_key_exists('visibility_handler', $config)) {
            $this->_usedProperties['visibilityHandler'] = true;
            $this->visibilityHandler = $config['visibility_handler'];
            unset($config['visibility_handler']);
        }

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

        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;
        }
        if (isset($this->_usedProperties['visibilityHandler'])) {
            $output['visibility_handler'] = $this->visibilityHandler;
        }
        if (isset($this->_usedProperties['streamReads'])) {
            $output['streamReads'] = $this->streamReads;
        }

        return $output;
    }

}
