// Path: coopr-server/src/main/java/co/cask/coopr/http/request/ClusterStatusResponse.java
// public class ClusterStatusResponse {
//   private final String clusterid;
//   private final int stepstotal;
//   private final int stepscompleted;
//   private final Cluster.Status status;
//   private final ClusterJob.Status actionstatus;
//   private final ClusterAction action;
// 
//   public ClusterStatusResponse(Cluster cluster, ClusterJob job) {
//     this.clusterid = cluster.getId();
//     this.status = cluster.getStatus();
//     this.actionstatus = job.getJobStatus();
//     this.action = job.getClusterAction();
//     Map<String, ClusterTask.Status> taskStatus = job.getTaskStatus();
// 
//     int completedTasks = 0;
//     for (Map.Entry<String, ClusterTask.Status> entry : taskStatus.entrySet()) {
//       if (entry.getValue().equals(ClusterTask.Status.COMPLETE)) {
//         completedTasks++;
//       }
//     }
//     this.stepscompleted = completedTasks;
//     this.stepstotal = taskStatus.size();
//   }
// 
//   public String getClusterid() {
//     return clusterid;
//   }
// 
//   public int getStepstotal() {
//     return stepstotal;
//   }
// 
//   public int getStepscompleted() {
//     return stepscompleted;
//   }
// 
//   public Cluster.Status getStatus() {
//     return status;
//   }
// 
//   public ClusterJob.Status getActionstatus() {
//     return actionstatus;
//   }
// 
//   public ClusterAction getAction() {
//     return action;
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) {
//       return true;
//     }
//     if (o == null || getClass() != o.getClass()) {
//       return false;
//     }
// 
//     ClusterStatusResponse that = (ClusterStatusResponse) o;
// 
//     return Objects.equal(clusterid, that.clusterid) &&
//       stepscompleted == that.stepscompleted &&
//       stepstotal == that.stepstotal &&
//       status == that.status &&
//       action == that.action &&
//       actionstatus == that.actionstatus;
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hashCode(clusterid, stepstotal, stepscompleted, status, actionstatus, action);
//   }
// }


import co.cask.coopr.cluster.ClusterDetails;
import co.cask.coopr.cluster.ClusterSummary;
import co.cask.coopr.http.request.AddServicesRequest;
import co.cask.coopr.http.request.ClusterConfigureRequest;
import co.cask.coopr.http.request.ClusterCreateRequest;
import co.cask.coopr.http.request.ClusterOperationRequest;
import co.cask.coopr.http.request.ClusterStatusResponse;
import com.google.gson.JsonObject;
import java.io.IOException;
import java.util.List;
/*
 * Copyright © 2012-2014 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package co.cask.coopr.client;



/**
 * The client API for manage clusters.
 */
public interface ClusterClient {

  /**
   * Provides a summary of details about all clusters visible to a user.
   * If there are no visible clusters, returns empty list.
   *
   * @return list of {@link co.cask.coopr.cluster.ClusterSummary} objects
   * @throws IOException in case of a problem or the connection was aborted
   */
  List<ClusterSummary> getClusters() throws IOException;

  /**
   * Provides full details about a cluster by id.
   *
   * @param clusterId String value of a cluster id
   * @return {@link co.cask.coopr.cluster.ClusterDetails} object
   * @throws IOException in case of a problem or the connection was aborted
   */
  ClusterDetails getCluster(String clusterId) throws IOException;

  /**
   * Deletes specified cluster by id.
   *
   * @param clusterId String value of a cluster id
   * @throws IOException in case of a problem or the connection was aborted
   */
  void deleteCluster(String clusterId) throws IOException;

  /**
   * Deletes specified cluster by id with optional provider fields.
   *
   * @param clusterId String value of a cluster id
   * @param clusterOperationRequest Request to delete the cluster, containing optional provider fields
   * @throws IOException in case of a problem or the connection was aborted
   */
  void deleteCluster(String clusterId, ClusterOperationRequest clusterOperationRequest) throws IOException;

  /**
   * Creates new Cluster according to the specified parameters.
   *
   * @param clusterCreateRequest {@link co.cask.coopr.http.request.ClusterCreateRequest} object
   * @return new Cluster id
   * @throws IOException in case of a problem or the connection was aborted
   */
  String createCluster(ClusterCreateRequest clusterCreateRequest) throws IOException;

  /**
   * Retrieves the status of a cluster by id.
   *
   * @param clusterId String value of a cluster id
   * @return {@link co.cask.coopr.http.request.ClusterStatusResponse} object
   * @throws IOException in case of a problem or the connection was aborted
   */
// Path: coopr-server/src/main/java/co/cask/coopr/http/request/ClusterStatusResponse.java
// public class ClusterStatusResponse {
//   private final String clusterid;
//   private final int stepstotal;
//   private final int stepscompleted;
//   private final Cluster.Status status;
//   private final ClusterJob.Status actionstatus;
//   private final ClusterAction action;
// 
//   public ClusterStatusResponse(Cluster cluster, ClusterJob job) {
//     this.clusterid = cluster.getId();
//     this.status = cluster.getStatus();
//     this.actionstatus = job.getJobStatus();
//     this.action = job.getClusterAction();
//     Map<String, ClusterTask.Status> taskStatus = job.getTaskStatus();
// 
//     int completedTasks = 0;
//     for (Map.Entry<String, ClusterTask.Status> entry : taskStatus.entrySet()) {
//       if (entry.getValue().equals(ClusterTask.Status.COMPLETE)) {
//         completedTasks++;
//       }
//     }
//     this.stepscompleted = completedTasks;
//     this.stepstotal = taskStatus.size();
//   }
// 
//   public String getClusterid() {
//     return clusterid;
//   }
// 
//   public int getStepstotal() {
//     return stepstotal;
//   }
// 
//   public int getStepscompleted() {
//     return stepscompleted;
//   }
// 
//   public Cluster.Status getStatus() {
//     return status;
//   }
// 
//   public ClusterJob.Status getActionstatus() {
//     return actionstatus;
//   }
// 
//   public ClusterAction getAction() {
//     return action;
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) {
//       return true;
//     }
//     if (o == null || getClass() != o.getClass()) {
//       return false;
//     }
// 
//     ClusterStatusResponse that = (ClusterStatusResponse) o;
// 
//     return Objects.equal(clusterid, that.clusterid) &&
//       stepscompleted == that.stepscompleted &&
//       stepstotal == that.stepstotal &&
//       status == that.status &&
//       action == that.action &&
//       actionstatus == that.actionstatus;
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hashCode(clusterid, stepstotal, stepscompleted, status, actionstatus, action);
//   }
// }


// Path: coopr-rest-client/src/main/java/co/cask/coopr/client/ClusterClient.java
import co.cask.coopr.cluster.ClusterDetails;
import co.cask.coopr.cluster.ClusterSummary;
import co.cask.coopr.http.request.AddServicesRequest;
import co.cask.coopr.http.request.ClusterConfigureRequest;
import co.cask.coopr.http.request.ClusterCreateRequest;
import co.cask.coopr.http.request.ClusterOperationRequest;
import co.cask.coopr.http.request.ClusterStatusResponse;
import com.google.gson.JsonObject;
import java.io.IOException;
import java.util.List;

/*
 * Copyright © 2012-2014 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package co.cask.coopr.client;



/**
 * The client API for manage clusters.
 */
public interface ClusterClient {

  /**
   * Provides a summary of details about all clusters visible to a user.
   * If there are no visible clusters, returns empty list.
   *
   * @return list of {@link co.cask.coopr.cluster.ClusterSummary} objects
   * @throws IOException in case of a problem or the connection was aborted
   */
  List<ClusterSummary> getClusters() throws IOException;

  /**
   * Provides full details about a cluster by id.
   *
   * @param clusterId String value of a cluster id
   * @return {@link co.cask.coopr.cluster.ClusterDetails} object
   * @throws IOException in case of a problem or the connection was aborted
   */
  ClusterDetails getCluster(String clusterId) throws IOException;

  /**
   * Deletes specified cluster by id.
   *
   * @param clusterId String value of a cluster id
   * @throws IOException in case of a problem or the connection was aborted
   */
  void deleteCluster(String clusterId) throws IOException;

  /**
   * Deletes specified cluster by id with optional provider fields.
   *
   * @param clusterId String value of a cluster id
   * @param clusterOperationRequest Request to delete the cluster, containing optional provider fields
   * @throws IOException in case of a problem or the connection was aborted
   */
  void deleteCluster(String clusterId, ClusterOperationRequest clusterOperationRequest) throws IOException;

  /**
   * Creates new Cluster according to the specified parameters.
   *
   * @param clusterCreateRequest {@link co.cask.coopr.http.request.ClusterCreateRequest} object
   * @return new Cluster id
   * @throws IOException in case of a problem or the connection was aborted
   */
  String createCluster(ClusterCreateRequest clusterCreateRequest) throws IOException;

  /**
   * Retrieves the status of a cluster by id.
   *
   * @param clusterId String value of a cluster id
   * @return {@link co.cask.coopr.http.request.ClusterStatusResponse} object
   * @throws IOException in case of a problem or the connection was aborted
   */
  ClusterStatusResponse getClusterStatus(String clusterId) throws IOException;