<?php

namespace Symfony\Config\Flysystem\StorageConfig;

require_once __DIR__.\DIRECTORY_SEPARATOR.'Ftp'.\DIRECTORY_SEPARATOR.'PermissionsConfig.php';

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 FtpConfig 
{
    private $host;
    private $username;
    private $password;
    private $port;
    private $root;
    private $passive;
    private $ssl;
    private $timeout;
    private $ignorePassiveAddress;
    private $utf8;
    private $transferMode;
    private $systemType;
    private $timestampsOnUnixListingsEnabled;
    private $recurseManually;
    private $useRawListOptions;
    private $connectivityChecker;
    private $permissions;
    private $_usedProperties = [];

    /**
     * FTP host
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function host($value): static
    {
        $this->_usedProperties['host'] = true;
        $this->host = $value;

        return $this;
    }

    /**
     * FTP username
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function username($value): static
    {
        $this->_usedProperties['username'] = true;
        $this->username = $value;

        return $this;
    }

    /**
     * FTP password
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function password($value): static
    {
        $this->_usedProperties['password'] = true;
        $this->password = $value;

        return $this;
    }

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

        return $this;
    }

    /**
     * FTP root directory
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function root($value): static
    {
        $this->_usedProperties['root'] = true;
        $this->root = $value;

        return $this;
    }

    /**
     * Use passive mode
     * @default true
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function passive($value): static
    {
        $this->_usedProperties['passive'] = true;
        $this->passive = $value;

        return $this;
    }

    /**
     * Use SSL/TLS encryption
     * @default false
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function ssl($value): static
    {
        $this->_usedProperties['ssl'] = true;
        $this->ssl = $value;

        return $this;
    }

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

        return $this;
    }

    /**
     * Ignore passive address
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function ignorePassiveAddress($value): static
    {
        $this->_usedProperties['ignorePassiveAddress'] = true;
        $this->ignorePassiveAddress = $value;

        return $this;
    }

    /**
     * Enable UTF8 mode
     * @default false
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function utf8($value): static
    {
        $this->_usedProperties['utf8'] = true;
        $this->utf8 = $value;

        return $this;
    }

    /**
     * Transfer mode (FTP_ASCII or FTP_BINARY constante on ftp extension)
     * @default null
     * @param ParamConfigurator|mixed $value
     * @return $this
     */
    public function transferMode($value): static
    {
        $this->_usedProperties['transferMode'] = true;
        $this->transferMode = $value;

        return $this;
    }

    /**
     * FTP system type
     * @default null
     * @param ParamConfigurator|NULL|'windows'|'unix' $value
     * @return $this
     */
    public function systemType($value): static
    {
        $this->_usedProperties['systemType'] = true;
        $this->systemType = $value;

        return $this;
    }

    /**
     * Enable timestamps on Unix listings
     * @default false
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function timestampsOnUnixListingsEnabled($value): static
    {
        $this->_usedProperties['timestampsOnUnixListingsEnabled'] = true;
        $this->timestampsOnUnixListingsEnabled = $value;

        return $this;
    }

    /**
     * Recurse directories manually
     * @default true
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function recurseManually($value): static
    {
        $this->_usedProperties['recurseManually'] = true;
        $this->recurseManually = $value;

        return $this;
    }

    /**
     * Use raw list options
     * @default null
     * @param ParamConfigurator|bool $value
     * @return $this
     */
    public function useRawListOptions($value): static
    {
        $this->_usedProperties['useRawListOptions'] = true;
        $this->useRawListOptions = $value;

        return $this;
    }

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

        return $this;
    }

    /**
     * Unix permissions configuration for files and directories
     * @default {"file":{"public":420,"private":384},"dir":{"public":493,"private":448}}
     */
    public function permissions(array $value = []): \Symfony\Config\Flysystem\StorageConfig\Ftp\PermissionsConfig
    {
        if (null === $this->permissions) {
            $this->_usedProperties['permissions'] = true;
            $this->permissions = new \Symfony\Config\Flysystem\StorageConfig\Ftp\PermissionsConfig($value);
        } elseif (0 < \func_num_args()) {
            throw new InvalidConfigurationException('The node created by "permissions()" has already been initialized. You cannot pass values the second time you call permissions().');
        }

        return $this->permissions;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if (array_key_exists('permissions', $config)) {
            $this->_usedProperties['permissions'] = true;
            $this->permissions = new \Symfony\Config\Flysystem\StorageConfig\Ftp\PermissionsConfig($config['permissions']);
            unset($config['permissions']);
        }

        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['host'])) {
            $output['host'] = $this->host;
        }
        if (isset($this->_usedProperties['username'])) {
            $output['username'] = $this->username;
        }
        if (isset($this->_usedProperties['password'])) {
            $output['password'] = $this->password;
        }
        if (isset($this->_usedProperties['port'])) {
            $output['port'] = $this->port;
        }
        if (isset($this->_usedProperties['root'])) {
            $output['root'] = $this->root;
        }
        if (isset($this->_usedProperties['passive'])) {
            $output['passive'] = $this->passive;
        }
        if (isset($this->_usedProperties['ssl'])) {
            $output['ssl'] = $this->ssl;
        }
        if (isset($this->_usedProperties['timeout'])) {
            $output['timeout'] = $this->timeout;
        }
        if (isset($this->_usedProperties['ignorePassiveAddress'])) {
            $output['ignore_passive_address'] = $this->ignorePassiveAddress;
        }
        if (isset($this->_usedProperties['utf8'])) {
            $output['utf8'] = $this->utf8;
        }
        if (isset($this->_usedProperties['transferMode'])) {
            $output['transfer_mode'] = $this->transferMode;
        }
        if (isset($this->_usedProperties['systemType'])) {
            $output['system_type'] = $this->systemType;
        }
        if (isset($this->_usedProperties['timestampsOnUnixListingsEnabled'])) {
            $output['timestamps_on_unix_listings_enabled'] = $this->timestampsOnUnixListingsEnabled;
        }
        if (isset($this->_usedProperties['recurseManually'])) {
            $output['recurse_manually'] = $this->recurseManually;
        }
        if (isset($this->_usedProperties['useRawListOptions'])) {
            $output['use_raw_list_options'] = $this->useRawListOptions;
        }
        if (isset($this->_usedProperties['connectivityChecker'])) {
            $output['connectivityChecker'] = $this->connectivityChecker;
        }
        if (isset($this->_usedProperties['permissions'])) {
            $output['permissions'] = $this->permissions->toArray();
        }

        return $output;
    }

}
