package com.hubspot.singularity.executor;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;


public class SingularityExecutorCleanupStatistics {

  private final int totalTaskFiles;
  private final int ioErrorTasks;
  private final int runningTasksIgnored;
  private final int mesosRunningTasks;
  private final int staleTasks;
  private final int successfullyCleanedTasks;
  private final int errorTasks;
  private final int invalidTasks; 
  
  @JsonCreator
  public SingularityExecutorCleanupStatistics(
      @JsonProperty("totalTaskFiles") int totalTaskFiles, 
      @JsonProperty("mesosRunningTasks") int mesosRunningTasks, 
      @JsonProperty("runningTasksIgnored") int runningTasksIgnored, 
      @JsonProperty("staleTasks") int staleTasks, 
      @JsonProperty("successfullyCleanedTasks") int successfullyCleanedTasks, 
      @JsonProperty("ioErrorTasks") int ioErrorTasks, 
      @JsonProperty("errorTasks") int errorTasks, 
      @JsonProperty("invalidTasks") int invalidTasks
    ) {
    this.totalTaskFiles = totalTaskFiles;
    this.mesosRunningTasks = mesosRunningTasks;
    this.runningTasksIgnored = runningTasksIgnored;
    this.staleTasks = staleTasks;
    this.ioErrorTasks = ioErrorTasks;
    this.successfullyCleanedTasks = successfullyCleanedTasks;
    this.errorTasks = errorTasks;
    this.invalidTasks = invalidTasks;
  }
  
  public int getRunningTasksIgnored() {
    return runningTasksIgnored;
  }

  public int getIoErrorTasks() {
    return ioErrorTasks;
  }

  public int getTotalTaskFiles() {
    return totalTaskFiles;
  }

  public int getMesosRunningTasks() {
    return mesosRunningTasks;
  }

  public int getStaleTasks() {
    return staleTasks;
  }

  public int getSuccessfullyCleanedTasks() {
    return successfullyCleanedTasks;
  }

  public int getErrorTasks() {
    return errorTasks;
  }

  public int getInvalidTasks() {
    return invalidTasks;
  }

  @Override
  public String toString() {
    return "SingularityExecutorCleanupStatistics [totalTaskFiles=" + totalTaskFiles + ", ioErrorTasks=" + ioErrorTasks + ", runningTasksIgnored=" + runningTasksIgnored + ", mesosRunningTasks=" + mesosRunningTasks + ", staleTasks=" + staleTasks
        + ", successfullyCleanedTasks=" + successfullyCleanedTasks + ", errorTasks=" + errorTasks + ", invalidTasks=" + invalidTasks + "]";
  }

  public static class SingularityExecutorCleanupStatisticsBuilder {
    
    private int totalTaskFiles;
    private int runningTasksIgnored;
    private int mesosRunningTasks;
    private int staleTasks;
    private int successfullyCleanedTasks;
    private int ioErrorTasks;
    private int errorTasks;
    private int invalidTasks; 
    
    public void incrTotalTaskFiles() {
      totalTaskFiles++;
    }
    
    public void incrRunningTasksIgnored() {
      runningTasksIgnored++;
    }
    
    public void incrIoErrorTasks() {
      ioErrorTasks++;
    }
    
    public void setMesosRunningTasks(int mesosRunningTasks) {
      this.mesosRunningTasks = mesosRunningTasks;
    }
    
    public void incrStaleTasks() {
      staleTasks++;
    }
    
    public void incrErrorTasks() {
      errorTasks++;
    }
    
    public void incrSuccessfullyCleanedTasks() {
      successfullyCleanedTasks++;
    }
    
    public void incrInvalidTasks() {
      invalidTasks++;
    }
      
    public SingularityExecutorCleanupStatistics build() {
      return new SingularityExecutorCleanupStatistics(totalTaskFiles, mesosRunningTasks, runningTasksIgnored, staleTasks, successfullyCleanedTasks, ioErrorTasks, errorTasks, invalidTasks);
    }
    
  }
  
}

@@ -352,40 +352,8 @@
 ks;%0A
-  private final int staleTasks;%0A
   pr
@@ -390,24 +390,24 @@
 eanedTasks;%0A
+
   private fi
@@ -723,59 +723,8 @@
 d, %0A
-      @JsonProperty(%22staleTasks%22) int staleTasks, %0A
     
@@ -1111,42 +1111,8 @@
 ed;%0A
-    this.staleTasks = staleTasks;%0A
     
@@ -1570,66 +1570,8 @@
  %7D%0A%0A
-  public int getStaleTasks() %7B%0A    return staleTasks;%0A  %7D%0A
 %0A  p
@@ -2033,39 +2033,8 @@
 asks
- + %22, staleTasks=%22 + staleTasks
 %0A   
@@ -2356,36 +2356,8 @@
 ks;%0A
-    private int staleTasks;%0A
     
@@ -2843,74 +2843,8 @@
    %0A
-    public void incrStaleTasks() %7B%0A      staleTasks++;%0A    %7D%0A    %0A
     
@@ -3125,24 +3125,24 @@
 s build() %7B%0A
+
       return
@@ -3242,20 +3242,8 @@
 red,
- staleTasks,
  suc

remove stale tasks