// Path: src/main/java/com/rapid7/appspider/datatransferobjects/ClientIdNamePair.java
// public final class ClientIdNamePair {
// 
//     private final String id;
//     private final String name;
// 
//     public ClientIdNamePair(String id, String name) {
//         this.id = id;
//         this.name = name;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
// }
// 
// Path: src/main/java/com/rapid7/appspider/datatransferobjects/ScanResult.java
// public class ScanResult {
//     private final boolean isSuccess;
//     private final String scanId;
// 
//     public ScanResult(boolean isSuccess, String scanId) {
//         this.isSuccess = isSuccess;
//         this.scanId = scanId;
//     }
//     public ScanResult(JSONObject jsonObject) {
//         if (jsonObject == null)
//             throw new IllegalArgumentException("jsonObject cannot be null");
// 
//         try {
//             isSuccess = jsonObject.getBoolean("IsSuccess");
//             scanId = jsonObject.getJSONObject("Scan").getString("Id");
// 
//         } catch(JSONException e) {
//             throw new IllegalArgumentException("unexpected error occured parsing scan result", e);
//         }
// 
//     }
// 
//     public String getScanId() {
//         return scanId;
//     }
// 
//     public boolean isSuccess() {
//         return isSuccess;
//     }
// }
// 
// Path: src/main/java/com/rapid7/appspider/models/AuthenticationModel.java
// public class AuthenticationModel {
// 
//     private final String username;
//     private final String password;
//     private final Optional<String> clientId;
// 
//     /**
//      * instantiates a new instance of the {@code AuthenticationModel} class with no client Id
//      */
//     public AuthenticationModel(String username, String password) {
//         this(username, password, Optional.empty());
//     }
// 
//     /**
//      * instantiates a new instance of the {@code AuthenticationModel} class ensuring that
//      * username and password are both non-null and non-empty
//      */
//     public AuthenticationModel(String username, String password, Optional<String> clientId) {
//         if (username == null || username.isEmpty() || password == null || password.isEmpty()) {
//             throw new IllegalArgumentException();
//         }
//         this.username = username;
//         this.password = password;
//         this.clientId = clientId;
//     }
// 
//     /**
//      * gets the password value
//      * @return password as a {@code Secret}
//      */
//     public String getPassword() {
//         return password;
//     }
// 
//     /**
//      * Get the username value
//      * @return username as a String
//      */
//     public String getUsername() {
//         return username;
//     }
// 
//     /**
//      * Returns whether this object contains a clientId or not
//      * 
//      * <p>
//      * should be called prior to {@code getClientId} to ensure a value is present,
//      * otherwise an exception may occur
//      * </p>
//      * @return true if client id is set; otherwise, false
//      */
//     public boolean hasClientId() {
//         return clientId.isPresent();
//     }
// 
//     /**
//      * Gets the client id if present; otherwise throws a {@code NoSuchElementException}
//      * @return the client Id if present
//      * @throws NoSuchElementException if this instance does not have a clientId
//      */
//     public String getClientId() throws NoSuchElementException {
//         return clientId.orElseThrow(NoSuchElementException::new);
//     }
// 
// 
// }


import com.rapid7.appspider.datatransferobjects.ClientIdNamePair;
import com.rapid7.appspider.datatransferobjects.ScanResult;
import com.rapid7.appspider.models.AuthenticationModel;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Optional;
/*
 * Copyright © 2003 - 2020 Rapid7, Inc.  All rights reserved.
 */

package com.rapid7.appspider;



public interface EnterpriseClient {
    /**
     * returns the full URL for the enterprise rest endpoint
     * @return the full URL for the enterprise rest endpoint
     */
    String getUrl();

    /**
     * calls the /Authentication/Login endpoint with provided details
     * @param authModel authentication details such as username, password and optionally clientId
     * @return on success Optional containing the authorization token; otherwise empty
     */
    Optional<String> login(AuthenticationModel authModel);

    /**
     * calls the /Authentication/Login endpoint with provided details returning true if credentials are valid
     * @param authModel authentication details such as username, password and optionally clientId
     * @return true if endpoint returns authorization token; otherwise, false
     */
// Path: src/main/java/com/rapid7/appspider/datatransferobjects/ClientIdNamePair.java
// public final class ClientIdNamePair {
// 
//     private final String id;
//     private final String name;
// 
//     public ClientIdNamePair(String id, String name) {
//         this.id = id;
//         this.name = name;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
// }
// 
// Path: src/main/java/com/rapid7/appspider/datatransferobjects/ScanResult.java
// public class ScanResult {
//     private final boolean isSuccess;
//     private final String scanId;
// 
//     public ScanResult(boolean isSuccess, String scanId) {
//         this.isSuccess = isSuccess;
//         this.scanId = scanId;
//     }
//     public ScanResult(JSONObject jsonObject) {
//         if (jsonObject == null)
//             throw new IllegalArgumentException("jsonObject cannot be null");
// 
//         try {
//             isSuccess = jsonObject.getBoolean("IsSuccess");
//             scanId = jsonObject.getJSONObject("Scan").getString("Id");
// 
//         } catch(JSONException e) {
//             throw new IllegalArgumentException("unexpected error occured parsing scan result", e);
//         }
// 
//     }
// 
//     public String getScanId() {
//         return scanId;
//     }
// 
//     public boolean isSuccess() {
//         return isSuccess;
//     }
// }
// 
// Path: src/main/java/com/rapid7/appspider/models/AuthenticationModel.java
// public class AuthenticationModel {
// 
//     private final String username;
//     private final String password;
//     private final Optional<String> clientId;
// 
//     /**
//      * instantiates a new instance of the {@code AuthenticationModel} class with no client Id
//      */
//     public AuthenticationModel(String username, String password) {
//         this(username, password, Optional.empty());
//     }
// 
//     /**
//      * instantiates a new instance of the {@code AuthenticationModel} class ensuring that
//      * username and password are both non-null and non-empty
//      */
//     public AuthenticationModel(String username, String password, Optional<String> clientId) {
//         if (username == null || username.isEmpty() || password == null || password.isEmpty()) {
//             throw new IllegalArgumentException();
//         }
//         this.username = username;
//         this.password = password;
//         this.clientId = clientId;
//     }
// 
//     /**
//      * gets the password value
//      * @return password as a {@code Secret}
//      */
//     public String getPassword() {
//         return password;
//     }
// 
//     /**
//      * Get the username value
//      * @return username as a String
//      */
//     public String getUsername() {
//         return username;
//     }
// 
//     /**
//      * Returns whether this object contains a clientId or not
//      * 
//      * <p>
//      * should be called prior to {@code getClientId} to ensure a value is present,
//      * otherwise an exception may occur
//      * </p>
//      * @return true if client id is set; otherwise, false
//      */
//     public boolean hasClientId() {
//         return clientId.isPresent();
//     }
// 
//     /**
//      * Gets the client id if present; otherwise throws a {@code NoSuchElementException}
//      * @return the client Id if present
//      * @throws NoSuchElementException if this instance does not have a clientId
//      */
//     public String getClientId() throws NoSuchElementException {
//         return clientId.orElseThrow(NoSuchElementException::new);
//     }
// 
// 
// }


// Path: src/main/java/com/rapid7/appspider/EnterpriseClient.java
import com.rapid7.appspider.datatransferobjects.ClientIdNamePair;
import com.rapid7.appspider.datatransferobjects.ScanResult;
import com.rapid7.appspider.models.AuthenticationModel;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Optional;

/*
 * Copyright © 2003 - 2020 Rapid7, Inc.  All rights reserved.
 */

package com.rapid7.appspider;



public interface EnterpriseClient {
    /**
     * returns the full URL for the enterprise rest endpoint
     * @return the full URL for the enterprise rest endpoint
     */
    String getUrl();

    /**
     * calls the /Authentication/Login endpoint with provided details
     * @param authModel authentication details such as username, password and optionally clientId
     * @return on success Optional containing the authorization token; otherwise empty
     */
    Optional<String> login(AuthenticationModel authModel);

    /**
     * calls the /Authentication/Login endpoint with provided details returning true if credentials are valid
     * @param authModel authentication details such as username, password and optionally clientId
     * @return true if endpoint returns authorization token; otherwise, false
     */
    boolean testAuthentication(AuthenticationModel authModel);