<?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 WebdavConfig 
{
    private $client;
    private $prefix;
    private $visibilityHandling;
    private $manualCopy;
    private $manualMove;
    private $_usedProperties = [];

    /**
     * The WebDAV 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;
    }

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

        return $this;
    }

    /**
     * How to handle visibility operations
     * @default 'throw'
     * @param ParamConfigurator|'throw'|'ignore' $value
     * @return $this
     */
    public function visibilityHandling($value): static
    {
        $this->_usedProperties['visibilityHandling'] = true;
        $this->visibilityHandling = $value;

        return $this;
    }

    /**
     * Whether to handle copy operations manually
     * @default false
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function manualCopy($value): static
    {
        $this->_usedProperties['manualCopy'] = true;
        $this->manualCopy = $value;

        return $this;
    }

    /**
     * Whether to handle move operations manually
     * @default false
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function manualMove($value): static
    {
        $this->_usedProperties['manualMove'] = true;
        $this->manualMove = $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('prefix', $config)) {
            $this->_usedProperties['prefix'] = true;
            $this->prefix = $config['prefix'];
            unset($config['prefix']);
        }

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

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

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

        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['prefix'])) {
            $output['prefix'] = $this->prefix;
        }
        if (isset($this->_usedProperties['visibilityHandling'])) {
            $output['visibility_handling'] = $this->visibilityHandling;
        }
        if (isset($this->_usedProperties['manualCopy'])) {
            $output['manual_copy'] = $this->manualCopy;
        }
        if (isset($this->_usedProperties['manualMove'])) {
            $output['manual_move'] = $this->manualMove;
        }

        return $output;
    }

}
