// Path: coopr-server/src/main/java/co/cask/coopr/scheduler/ClusterAction.java
// public enum ClusterAction {
//   SOLVE_LAYOUT(Cluster.Status.TERMINATED),
//   CLUSTER_CREATE(Cluster.Status.INCOMPLETE),
//   CLUSTER_DELETE(Cluster.Status.INCOMPLETE),
//   CLUSTER_CONFIGURE(Cluster.Status.INCONSISTENT),
//   CLUSTER_CONFIGURE_WITH_RESTART(Cluster.Status.INCONSISTENT),
//   STOP_SERVICES(Cluster.Status.INCONSISTENT),
//   START_SERVICES(Cluster.Status.INCONSISTENT),
//   RESTART_SERVICES(Cluster.Status.INCONSISTENT),
//   ADD_SERVICES(Cluster.Status.INCONSISTENT);
// 
//   // these are runtime actions for services that don't change cluster state
//   public static final Set<ClusterAction> SERVICE_RUNTIME_ACTIONS = ImmutableSet.of(
//     STOP_SERVICES, START_SERVICES, RESTART_SERVICES);
//   private final Cluster.Status failureStatus;
// 
//   ClusterAction(Cluster.Status status) {
//     failureStatus = status;
//   }
// 
//   public Cluster.Status getFailureStatus() {
//     return failureStatus;
//   }
// }


import co.cask.coopr.scheduler.ClusterAction;
import co.cask.coopr.scheduler.task.ClusterJob;
import co.cask.coopr.scheduler.task.ClusterTask;
import com.google.common.base.Objects;
package co.cask.coopr.cluster;


/**
 * Summary of the progress of a {@link ClusterJob}.
 */
public class ClusterJobProgress {
  private final ClusterAction action;
  private final ClusterJob.Status actionstatus;
  private final int stepstotal;
  private final int stepscompleted;

  public ClusterJobProgress(ClusterJob job) {
    this.action = job.getClusterAction();
    this.actionstatus = job.getJobStatus();
    this.stepstotal = job.getTaskStatus().size();

    int completedTasks = 0;
    for (ClusterTask.Status taskStatus : job.getTaskStatus().values()) {
      if (taskStatus == ClusterTask.Status.COMPLETE) {
        completedTasks++;
      }
    }
    this.stepscompleted = completedTasks;
  }

// Path: coopr-server/src/main/java/co/cask/coopr/scheduler/ClusterAction.java
// public enum ClusterAction {
//   SOLVE_LAYOUT(Cluster.Status.TERMINATED),
//   CLUSTER_CREATE(Cluster.Status.INCOMPLETE),
//   CLUSTER_DELETE(Cluster.Status.INCOMPLETE),
//   CLUSTER_CONFIGURE(Cluster.Status.INCONSISTENT),
//   CLUSTER_CONFIGURE_WITH_RESTART(Cluster.Status.INCONSISTENT),
//   STOP_SERVICES(Cluster.Status.INCONSISTENT),
//   START_SERVICES(Cluster.Status.INCONSISTENT),
//   RESTART_SERVICES(Cluster.Status.INCONSISTENT),
//   ADD_SERVICES(Cluster.Status.INCONSISTENT);
// 
//   // these are runtime actions for services that don't change cluster state
//   public static final Set<ClusterAction> SERVICE_RUNTIME_ACTIONS = ImmutableSet.of(
//     STOP_SERVICES, START_SERVICES, RESTART_SERVICES);
//   private final Cluster.Status failureStatus;
// 
//   ClusterAction(Cluster.Status status) {
//     failureStatus = status;
//   }
// 
//   public Cluster.Status getFailureStatus() {
//     return failureStatus;
//   }
// }


// Path: coopr-server/src/main/java/co/cask/coopr/cluster/ClusterJobProgress.java
import co.cask.coopr.scheduler.ClusterAction;
import co.cask.coopr.scheduler.task.ClusterJob;
import co.cask.coopr.scheduler.task.ClusterTask;
import com.google.common.base.Objects;

package co.cask.coopr.cluster;


/**
 * Summary of the progress of a {@link ClusterJob}.
 */
public class ClusterJobProgress {
  private final ClusterAction action;
  private final ClusterJob.Status actionstatus;
  private final int stepstotal;
  private final int stepscompleted;

  public ClusterJobProgress(ClusterJob job) {
    this.action = job.getClusterAction();
    this.actionstatus = job.getJobStatus();
    this.stepstotal = job.getTaskStatus().size();

    int completedTasks = 0;
    for (ClusterTask.Status taskStatus : job.getTaskStatus().values()) {
      if (taskStatus == ClusterTask.Status.COMPLETE) {
        completedTasks++;
      }
    }
    this.stepscompleted = completedTasks;
  }

  public ClusterAction getAction() {