/*
 * Cloudera Manager API
 * <h1>Cloudera Manager API v50</h1>       <p>Introduced in Cloudera Manager 7.8.1</p>       <p><a href=\"http://www.cloudera.com/documentation.html\">Cloudera Product Documentation</a></p>
 *
 * OpenAPI spec version: 7.8.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 com.cloudera.api.swagger.model.ApiClusterRef;
import com.cloudera.api.swagger.model.ApiCommand;
import com.cloudera.api.swagger.model.ApiCommandStep;
import com.cloudera.api.swagger.model.ApiCommandStepProcess;
import com.cloudera.api.swagger.model.ApiHostRef;
import com.cloudera.api.swagger.model.ApiRemoteCommand;
import com.cloudera.api.swagger.model.ApiRoleRef;
import com.cloudera.api.swagger.model.ApiServiceRef;
import com.cloudera.api.swagger.model.State;
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.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Provides detailed information about a step of a command.
 */
@ApiModel(description = "Provides detailed information about a step of a command.")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2022-11-17T16:38:34.097Z")
public class ApiCommandStep {
  @SerializedName("description")
  private String description = null;

  @SerializedName("startTime")
  private String startTime = null;

  @SerializedName("endTime")
  private String endTime = null;

  @SerializedName("state")
  private State state = null;

  @SerializedName("resultMessage")
  private String resultMessage = null;

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

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

  @SerializedName("processes")
  private List<ApiCommandStepProcess> processes = null;

  @SerializedName("clientConfigs")
  private List<ApiCommandStepProcess> clientConfigs = null;

  @SerializedName("roles")
  private List<ApiRoleRef> roles = null;

  @SerializedName("clusters")
  private List<ApiClusterRef> clusters = null;

  @SerializedName("hosts")
  private List<ApiHostRef> hosts = null;

  @SerializedName("services")
  private List<ApiServiceRef> services = null;

  @SerializedName("children")
  private List<ApiCommandStep> children = null;

  @SerializedName("commands")
  private List<ApiCommand> commands = null;

  @SerializedName("remoteCommand")
  private ApiRemoteCommand remoteCommand = null;

  public ApiCommandStep description(String description) {
    this.description = description;
    return this;
  }

   /**
   * The command step description.
   * @return description
  **/
  @ApiModelProperty(value = "The command step description.")
  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public ApiCommandStep startTime(String startTime) {
    this.startTime = startTime;
    return this;
  }

   /**
   * The start time.
   * @return startTime
  **/
  @ApiModelProperty(value = "The start time.")
  public String getStartTime() {
    return startTime;
  }

  public void setStartTime(String startTime) {
    this.startTime = startTime;
  }

  public ApiCommandStep endTime(String endTime) {
    this.endTime = endTime;
    return this;
  }

   /**
   * The end time, if the command step is finished.
   * @return endTime
  **/
  @ApiModelProperty(value = "The end time, if the command step is finished.")
  public String getEndTime() {
    return endTime;
  }

  public void setEndTime(String endTime) {
    this.endTime = endTime;
  }

  public ApiCommandStep state(State state) {
    this.state = state;
    return this;
  }

   /**
   * Current state of the command step
   * @return state
  **/
  @ApiModelProperty(value = "Current state of the command step")
  public State getState() {
    return state;
  }

  public void setState(State state) {
    this.state = state;
  }

  public ApiCommandStep resultMessage(String resultMessage) {
    this.resultMessage = resultMessage;
    return this;
  }

   /**
   * If the command step is finished, the result message.
   * @return resultMessage
  **/
  @ApiModelProperty(value = "If the command step is finished, the result message.")
  public String getResultMessage() {
    return resultMessage;
  }

  public void setResultMessage(String resultMessage) {
    this.resultMessage = resultMessage;
  }

  public ApiCommandStep ignoreError(Boolean ignoreError) {
    this.ignoreError = ignoreError;
    return this;
  }

   /**
   * Whether the step will continue even upon error.
   * @return ignoreError
  **/
  @ApiModelProperty(value = "Whether the step will continue even upon error.")
  public Boolean getIgnoreError() {
    return ignoreError;
  }

  public void setIgnoreError(Boolean ignoreError) {
    this.ignoreError = ignoreError;
  }

  public ApiCommandStep parallel(Boolean parallel) {
    this.parallel = parallel;
    return this;
  }

   /**
   * Whether the children are scattered simultaneously, i.e. parallel. If not they would execute one after another, i.e. serially.
   * @return parallel
  **/
  @ApiModelProperty(value = "Whether the children are scattered simultaneously, i.e. parallel. If not they would execute one after another, i.e. serially.")
  public Boolean getParallel() {
    return parallel;
  }

  public void setParallel(Boolean parallel) {
    this.parallel = parallel;
  }

  public ApiCommandStep processes(List<ApiCommandStepProcess> processes) {
    this.processes = processes;
    return this;
  }

  public ApiCommandStep addProcessesItem(ApiCommandStepProcess processesItem) {
    if (this.processes == null) {
      this.processes = new ArrayList<ApiCommandStepProcess>();
    }
    this.processes.add(processesItem);
    return this;
  }

   /**
   * List of processes executed by the command step.
   * @return processes
  **/
  @ApiModelProperty(value = "List of processes executed by the command step.")
  public List<ApiCommandStepProcess> getProcesses() {
    return processes;
  }

  public void setProcesses(List<ApiCommandStepProcess> processes) {
    this.processes = processes;
  }

  public ApiCommandStep clientConfigs(List<ApiCommandStepProcess> clientConfigs) {
    this.clientConfigs = clientConfigs;
    return this;
  }

  public ApiCommandStep addClientConfigsItem(ApiCommandStepProcess clientConfigsItem) {
    if (this.clientConfigs == null) {
      this.clientConfigs = new ArrayList<ApiCommandStepProcess>();
    }
    this.clientConfigs.add(clientConfigsItem);
    return this;
  }

   /**
   * List of command step client configs.
   * @return clientConfigs
  **/
  @ApiModelProperty(value = "List of command step client configs.")
  public List<ApiCommandStepProcess> getClientConfigs() {
    return clientConfigs;
  }

  public void setClientConfigs(List<ApiCommandStepProcess> clientConfigs) {
    this.clientConfigs = clientConfigs;
  }

  public ApiCommandStep roles(List<ApiRoleRef> roles) {
    this.roles = roles;
    return this;
  }

  public ApiCommandStep addRolesItem(ApiRoleRef rolesItem) {
    if (this.roles == null) {
      this.roles = new ArrayList<ApiRoleRef>();
    }
    this.roles.add(rolesItem);
    return this;
  }

   /**
   * List of command step roles.
   * @return roles
  **/
  @ApiModelProperty(value = "List of command step roles.")
  public List<ApiRoleRef> getRoles() {
    return roles;
  }

  public void setRoles(List<ApiRoleRef> roles) {
    this.roles = roles;
  }

  public ApiCommandStep clusters(List<ApiClusterRef> clusters) {
    this.clusters = clusters;
    return this;
  }

  public ApiCommandStep addClustersItem(ApiClusterRef clustersItem) {
    if (this.clusters == null) {
      this.clusters = new ArrayList<ApiClusterRef>();
    }
    this.clusters.add(clustersItem);
    return this;
  }

   /**
   * List of clusters associated with command step.
   * @return clusters
  **/
  @ApiModelProperty(value = "List of clusters associated with command step.")
  public List<ApiClusterRef> getClusters() {
    return clusters;
  }

  public void setClusters(List<ApiClusterRef> clusters) {
    this.clusters = clusters;
  }

  public ApiCommandStep hosts(List<ApiHostRef> hosts) {
    this.hosts = hosts;
    return this;
  }

  public ApiCommandStep addHostsItem(ApiHostRef hostsItem) {
    if (this.hosts == null) {
      this.hosts = new ArrayList<ApiHostRef>();
    }
    this.hosts.add(hostsItem);
    return this;
  }

   /**
   * List of hosts associated with command step.
   * @return hosts
  **/
  @ApiModelProperty(value = "List of hosts associated with command step.")
  public List<ApiHostRef> getHosts() {
    return hosts;
  }

  public void setHosts(List<ApiHostRef> hosts) {
    this.hosts = hosts;
  }

  public ApiCommandStep services(List<ApiServiceRef> services) {
    this.services = services;
    return this;
  }

  public ApiCommandStep addServicesItem(ApiServiceRef servicesItem) {
    if (this.services == null) {
      this.services = new ArrayList<ApiServiceRef>();
    }
    this.services.add(servicesItem);
    return this;
  }

   /**
   * List of services associated with command step.
   * @return services
  **/
  @ApiModelProperty(value = "List of services associated with command step.")
  public List<ApiServiceRef> getServices() {
    return services;
  }

  public void setServices(List<ApiServiceRef> services) {
    this.services = services;
  }

  public ApiCommandStep children(List<ApiCommandStep> children) {
    this.children = children;
    return this;
  }

  public ApiCommandStep addChildrenItem(ApiCommandStep childrenItem) {
    if (this.children == null) {
      this.children = new ArrayList<ApiCommandStep>();
    }
    this.children.add(childrenItem);
    return this;
  }

   /**
   * List of child command steps.
   * @return children
  **/
  @ApiModelProperty(value = "List of child command steps.")
  public List<ApiCommandStep> getChildren() {
    return children;
  }

  public void setChildren(List<ApiCommandStep> children) {
    this.children = children;
  }

  public ApiCommandStep commands(List<ApiCommand> commands) {
    this.commands = commands;
    return this;
  }

  public ApiCommandStep addCommandsItem(ApiCommand commandsItem) {
    if (this.commands == null) {
      this.commands = new ArrayList<ApiCommand>();
    }
    this.commands.add(commandsItem);
    return this;
  }

   /**
   * List of subcommands. &lt;p&gt; The list contains only the summary view of the commands.
   * @return commands
  **/
  @ApiModelProperty(value = "List of subcommands. <p> The list contains only the summary view of the commands.")
  public List<ApiCommand> getCommands() {
    return commands;
  }

  public void setCommands(List<ApiCommand> commands) {
    this.commands = commands;
  }

  public ApiCommandStep remoteCommand(ApiRemoteCommand remoteCommand) {
    this.remoteCommand = remoteCommand;
    return this;
  }

   /**
   * Remote command executed by the current step on a peer cluster.
   * @return remoteCommand
  **/
  @ApiModelProperty(value = "Remote command executed by the current step on a peer cluster.")
  public ApiRemoteCommand getRemoteCommand() {
    return remoteCommand;
  }

  public void setRemoteCommand(ApiRemoteCommand remoteCommand) {
    this.remoteCommand = remoteCommand;
  }


  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ApiCommandStep apiCommandStep = (ApiCommandStep) o;
    return Objects.equals(this.description, apiCommandStep.description) &&
        Objects.equals(this.startTime, apiCommandStep.startTime) &&
        Objects.equals(this.endTime, apiCommandStep.endTime) &&
        Objects.equals(this.state, apiCommandStep.state) &&
        Objects.equals(this.resultMessage, apiCommandStep.resultMessage) &&
        Objects.equals(this.ignoreError, apiCommandStep.ignoreError) &&
        Objects.equals(this.parallel, apiCommandStep.parallel) &&
        Objects.equals(this.processes, apiCommandStep.processes) &&
        Objects.equals(this.clientConfigs, apiCommandStep.clientConfigs) &&
        Objects.equals(this.roles, apiCommandStep.roles) &&
        Objects.equals(this.clusters, apiCommandStep.clusters) &&
        Objects.equals(this.hosts, apiCommandStep.hosts) &&
        Objects.equals(this.services, apiCommandStep.services) &&
        Objects.equals(this.children, apiCommandStep.children) &&
        Objects.equals(this.commands, apiCommandStep.commands) &&
        Objects.equals(this.remoteCommand, apiCommandStep.remoteCommand);
  }

  @Override
  public int hashCode() {
    return Objects.hash(description, startTime, endTime, state, resultMessage, ignoreError, parallel, processes, clientConfigs, roles, clusters, hosts, services, children, commands, remoteCommand);
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ApiCommandStep {\n");
    
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    startTime: ").append(toIndentedString(startTime)).append("\n");
    sb.append("    endTime: ").append(toIndentedString(endTime)).append("\n");
    sb.append("    state: ").append(toIndentedString(state)).append("\n");
    sb.append("    resultMessage: ").append(toIndentedString(resultMessage)).append("\n");
    sb.append("    ignoreError: ").append(toIndentedString(ignoreError)).append("\n");
    sb.append("    parallel: ").append(toIndentedString(parallel)).append("\n");
    sb.append("    processes: ").append(toIndentedString(processes)).append("\n");
    sb.append("    clientConfigs: ").append(toIndentedString(clientConfigs)).append("\n");
    sb.append("    roles: ").append(toIndentedString(roles)).append("\n");
    sb.append("    clusters: ").append(toIndentedString(clusters)).append("\n");
    sb.append("    hosts: ").append(toIndentedString(hosts)).append("\n");
    sb.append("    services: ").append(toIndentedString(services)).append("\n");
    sb.append("    children: ").append(toIndentedString(children)).append("\n");
    sb.append("    commands: ").append(toIndentedString(commands)).append("\n");
    sb.append("    remoteCommand: ").append(toIndentedString(remoteCommand)).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    ");
  }
  
}

