package be.iminds.ilabt.jfed.rspec.model;

/**
 * LoginService
 */
public class LoginService {
    private final String authentication;
    private final String hostname;
    private final String port;
    private final String username;

    public LoginService(String authentication, String hostname, String port, String username) {
        this.authentication = authentication;
        this.hostname = hostname;
        this.port = port;
        this.username = username;
    }

    public LoginService(LoginService o) {
        authentication = o.authentication;
        hostname = o.hostname;
        port = o.port;
        username = o.username;
    }

    public String getAuthentication() {
        return authentication;
    }

    public String getHostname() {
        return hostname;
    }

    public String getPort() {
        return port;
    }

    public int getIntPort() {
        if (port != null)
            try {
                return Integer.parseInt(port);
            } catch (NumberFormatException e) {
                return -1;
            }
        else
            return 22;
    }

    public String getUsername() {
        return username;
    }
}
