/*
 * Classname: SftpConfiguration
 *
 * Version: 1.0
 *
 * Author: Alex Usun
 */
package com.jscape.inet.sftp;

import com.jscape.inet.ssh.SshConfiguration;

import static com.jscape.util.Parameters.assertNotNull;

/**
 * A SFTP configuration. Holds various SFTP-specific parameters.
 *
 * @author Alex Usun
 */
public class SftpConfiguration {

    public SshConfiguration sshConfiguration;
    public boolean subsystemResponseRequired;

    /**
     * Returns a configuration instance with default parameters.
     *
     * @param softwareVersion a software version
     *
     * @return a configuration instance
     */
    public static SftpConfiguration defaultConfiguration(String softwareVersion) {
        return new SftpConfiguration(SshConfiguration.defaultClientConfiguration(softwareVersion), true);
    }

    /**
     * Returns a configuration instance with default parameters.
     *
     * @return a configuration instance
     */
    public static SftpConfiguration defaultConfiguration() {
        return new SftpConfiguration(SshConfiguration.defaultClientConfiguration(), true);
    }

    /**
     * Creates a new configuration instance.
     *
     * @param sshConfiguration a SSH configuration
     * @param subsystemResponseRequired a sub-system response required flag
     */
    public SftpConfiguration(SshConfiguration sshConfiguration, boolean subsystemResponseRequired) {
        assertNotNull(sshConfiguration);
        this.sshConfiguration = sshConfiguration;

        this.subsystemResponseRequired = subsystemResponseRequired;
    }

    @Override
    public String toString() {
        return "SftpConfiguration {"
               + "sshConfiguration=" + this.sshConfiguration
               + ", subsystemResponseRequired=" + this.subsystemResponseRequired
               + '}';
    }
}
