/*
 * Cloudera Manager API
 * <h1>Cloudera Manager API v57</h1>       <p>Introduced in Cloudera Manager 7.13.1</p>       <p><a href=\"http://www.cloudera.com/documentation.html\">Cloudera Product Documentation</a></p>
 *
 * OpenAPI spec version: 7.13.1
 * 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package com.cloudera.api.swagger.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
 * Arguments used for Rolling Restart commands.
 */
@Schema(description = "Arguments used for Rolling Restart commands.")
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-05-19T08:29:59.033Z[Etc/UTC]")

public class ApiRollingRestartArgs {
  @SerializedName("slaveBatchSize")
  private java.math.BigDecimal slaveBatchSize = null;

  @SerializedName("sleepSeconds")
  private java.math.BigDecimal sleepSeconds = null;

  @SerializedName("slaveFailCountThreshold")
  private java.math.BigDecimal slaveFailCountThreshold = null;

  @SerializedName("staleConfigsOnly")
  private Boolean staleConfigsOnly = null;

  @SerializedName("unUpgradedOnly")
  private Boolean unUpgradedOnly = null;

  @SerializedName("restartRoleTypes")
  private List<String> restartRoleTypes = null;

  @SerializedName("restartRoleNames")
  private List<String> restartRoleNames = null;

  public ApiRollingRestartArgs slaveBatchSize(java.math.BigDecimal slaveBatchSize) {
    this.slaveBatchSize = slaveBatchSize;
    return this;
  }

   /**
   * Number of slave roles to restart at a time. Must be greater than zero. Default is 1.  Please note that for HDFS, this number should be less than the replication factor (default 3) to ensure data availability during rolling restart.
   * @return slaveBatchSize
  **/
  @Schema(description = "Number of slave roles to restart at a time. Must be greater than zero. Default is 1.  Please note that for HDFS, this number should be less than the replication factor (default 3) to ensure data availability during rolling restart.")
  public java.math.BigDecimal getSlaveBatchSize() {
    return slaveBatchSize;
  }

  public void setSlaveBatchSize(java.math.BigDecimal slaveBatchSize) {
    this.slaveBatchSize = slaveBatchSize;
  }

  public ApiRollingRestartArgs sleepSeconds(java.math.BigDecimal sleepSeconds) {
    this.sleepSeconds = sleepSeconds;
    return this;
  }

   /**
   * Number of seconds to sleep between restarts of slave role batches.  Must be greater than or equal to 0. Default is 0.
   * @return sleepSeconds
  **/
  @Schema(description = "Number of seconds to sleep between restarts of slave role batches.  Must be greater than or equal to 0. Default is 0.")
  public java.math.BigDecimal getSleepSeconds() {
    return sleepSeconds;
  }

  public void setSleepSeconds(java.math.BigDecimal sleepSeconds) {
    this.sleepSeconds = sleepSeconds;
  }

  public ApiRollingRestartArgs slaveFailCountThreshold(java.math.BigDecimal slaveFailCountThreshold) {
    this.slaveFailCountThreshold = slaveFailCountThreshold;
    return this;
  }

   /**
   * The threshold for number of slave batches that are allowed to fail to restart before the entire command is considered failed.  Must be greather than or equal to 0. Default is 0. &lt;p&gt; This argument is for ADVANCED users only. &lt;/p&gt;
   * @return slaveFailCountThreshold
  **/
  @Schema(description = "The threshold for number of slave batches that are allowed to fail to restart before the entire command is considered failed.  Must be greather than or equal to 0. Default is 0. <p> This argument is for ADVANCED users only. </p>")
  public java.math.BigDecimal getSlaveFailCountThreshold() {
    return slaveFailCountThreshold;
  }

  public void setSlaveFailCountThreshold(java.math.BigDecimal slaveFailCountThreshold) {
    this.slaveFailCountThreshold = slaveFailCountThreshold;
  }

  public ApiRollingRestartArgs staleConfigsOnly(Boolean staleConfigsOnly) {
    this.staleConfigsOnly = staleConfigsOnly;
    return this;
  }

   /**
   * Restart roles with stale configs only.
   * @return staleConfigsOnly
  **/
  @Schema(description = "Restart roles with stale configs only.")
  public Boolean isStaleConfigsOnly() {
    return staleConfigsOnly;
  }

  public void setStaleConfigsOnly(Boolean staleConfigsOnly) {
    this.staleConfigsOnly = staleConfigsOnly;
  }

  public ApiRollingRestartArgs unUpgradedOnly(Boolean unUpgradedOnly) {
    this.unUpgradedOnly = unUpgradedOnly;
    return this;
  }

   /**
   * Restart roles that haven&#x27;t been upgraded yet.
   * @return unUpgradedOnly
  **/
  @Schema(description = "Restart roles that haven't been upgraded yet.")
  public Boolean isUnUpgradedOnly() {
    return unUpgradedOnly;
  }

  public void setUnUpgradedOnly(Boolean unUpgradedOnly) {
    this.unUpgradedOnly = unUpgradedOnly;
  }

  public ApiRollingRestartArgs restartRoleTypes(List<String> restartRoleTypes) {
    this.restartRoleTypes = restartRoleTypes;
    return this;
  }

  public ApiRollingRestartArgs addRestartRoleTypesItem(String restartRoleTypesItem) {
    if (this.restartRoleTypes == null) {
      this.restartRoleTypes = new ArrayList<>();
    }
    this.restartRoleTypes.add(restartRoleTypesItem);
    return this;
  }

   /**
   * Role types to restart. If not specified, all startable roles are restarted.  Both role types and role names should not be specified.
   * @return restartRoleTypes
  **/
  @Schema(description = "Role types to restart. If not specified, all startable roles are restarted.  Both role types and role names should not be specified.")
  public List<String> getRestartRoleTypes() {
    return restartRoleTypes;
  }

  public void setRestartRoleTypes(List<String> restartRoleTypes) {
    this.restartRoleTypes = restartRoleTypes;
  }

  public ApiRollingRestartArgs restartRoleNames(List<String> restartRoleNames) {
    this.restartRoleNames = restartRoleNames;
    return this;
  }

  public ApiRollingRestartArgs addRestartRoleNamesItem(String restartRoleNamesItem) {
    if (this.restartRoleNames == null) {
      this.restartRoleNames = new ArrayList<>();
    }
    this.restartRoleNames.add(restartRoleNamesItem);
    return this;
  }

   /**
   * List of specific roles to restart. If none are specified, then all roles of specified role types are restarted.  Both role types and role names should not be specified.
   * @return restartRoleNames
  **/
  @Schema(description = "List of specific roles to restart. If none are specified, then all roles of specified role types are restarted.  Both role types and role names should not be specified.")
  public List<String> getRestartRoleNames() {
    return restartRoleNames;
  }

  public void setRestartRoleNames(List<String> restartRoleNames) {
    this.restartRoleNames = restartRoleNames;
  }


  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ApiRollingRestartArgs apiRollingRestartArgs = (ApiRollingRestartArgs) o;
    return Objects.equals(this.slaveBatchSize, apiRollingRestartArgs.slaveBatchSize) &&
        Objects.equals(this.sleepSeconds, apiRollingRestartArgs.sleepSeconds) &&
        Objects.equals(this.slaveFailCountThreshold, apiRollingRestartArgs.slaveFailCountThreshold) &&
        Objects.equals(this.staleConfigsOnly, apiRollingRestartArgs.staleConfigsOnly) &&
        Objects.equals(this.unUpgradedOnly, apiRollingRestartArgs.unUpgradedOnly) &&
        Objects.equals(this.restartRoleTypes, apiRollingRestartArgs.restartRoleTypes) &&
        Objects.equals(this.restartRoleNames, apiRollingRestartArgs.restartRoleNames);
  }

  @Override
  public int hashCode() {
    return Objects.hash(slaveBatchSize, sleepSeconds, slaveFailCountThreshold, staleConfigsOnly, unUpgradedOnly, restartRoleTypes, restartRoleNames);
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ApiRollingRestartArgs {\n");
    
    sb.append("    slaveBatchSize: ").append(toIndentedString(slaveBatchSize)).append("\n");
    sb.append("    sleepSeconds: ").append(toIndentedString(sleepSeconds)).append("\n");
    sb.append("    slaveFailCountThreshold: ").append(toIndentedString(slaveFailCountThreshold)).append("\n");
    sb.append("    staleConfigsOnly: ").append(toIndentedString(staleConfigsOnly)).append("\n");
    sb.append("    unUpgradedOnly: ").append(toIndentedString(unUpgradedOnly)).append("\n");
    sb.append("    restartRoleTypes: ").append(toIndentedString(restartRoleTypes)).append("\n");
    sb.append("    restartRoleNames: ").append(toIndentedString(restartRoleNames)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}
