/*
 * 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.cloudera.api.swagger.model.ApiCommissionState;
import com.cloudera.api.swagger.model.ApiConfigList;
import com.cloudera.api.swagger.model.ApiConfigStalenessStatus;
import com.cloudera.api.swagger.model.ApiEntityStatus;
import com.cloudera.api.swagger.model.ApiEntityTag;
import com.cloudera.api.swagger.model.ApiEntityType;
import com.cloudera.api.swagger.model.ApiHealthCheck;
import com.cloudera.api.swagger.model.ApiHealthSummary;
import com.cloudera.api.swagger.model.ApiHostRef;
import com.cloudera.api.swagger.model.ApiRoleConfigGroupRef;
import com.cloudera.api.swagger.model.ApiRoleState;
import com.cloudera.api.swagger.model.ApiServiceRef;
import com.cloudera.api.swagger.model.HaStatus;
import com.cloudera.api.swagger.model.ZooKeeperServerMode;
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;
/**
 * A role represents a specific entity that participate in a service. Examples are JobTrackers, DataNodes, HBase Masters. Each role is assigned a host where it runs on.
 */
@Schema(description = "A role represents a specific entity that participate in a service. Examples are JobTrackers, DataNodes, HBase Masters. Each role is assigned a host where it runs on.")
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2026-05-19T08:29:59.033Z[Etc/UTC]")

public class ApiRole {
  @SerializedName("name")
  private String name = null;

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

  @SerializedName("hostRef")
  private ApiHostRef hostRef = null;

  @SerializedName("serviceRef")
  private ApiServiceRef serviceRef = null;

  @SerializedName("roleState")
  private ApiRoleState roleState = null;

  @SerializedName("commissionState")
  private ApiCommissionState commissionState = null;

  @SerializedName("healthSummary")
  private ApiHealthSummary healthSummary = null;

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

  @SerializedName("configStalenessStatus")
  private ApiConfigStalenessStatus configStalenessStatus = null;

  @SerializedName("healthChecks")
  private List<ApiHealthCheck> healthChecks = null;

  @SerializedName("haStatus")
  private HaStatus haStatus = null;

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

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

  @SerializedName("maintenanceOwners")
  private List<ApiEntityType> maintenanceOwners = null;

  @SerializedName("config")
  private ApiConfigList config = null;

  @SerializedName("roleConfigGroupRef")
  private ApiRoleConfigGroupRef roleConfigGroupRef = null;

  @SerializedName("zooKeeperServerMode")
  private ZooKeeperServerMode zooKeeperServerMode = null;

  @SerializedName("entityStatus")
  private ApiEntityStatus entityStatus = null;

  @SerializedName("tags")
  private List<ApiEntityTag> tags = null;

  public ApiRole name(String name) {
    this.name = name;
    return this;
  }

   /**
   * The name of the role. Optional when creating a role since API v6. If not specified, a name will be automatically generated for the role.
   * @return name
  **/
  @Schema(description = "The name of the role. Optional when creating a role since API v6. If not specified, a name will be automatically generated for the role.")
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public ApiRole type(String type) {
    this.type = type;
    return this;
  }

   /**
   * The type of the role, e.g. NAMENODE, DATANODE, TASKTRACKER.
   * @return type
  **/
  @Schema(description = "The type of the role, e.g. NAMENODE, DATANODE, TASKTRACKER.")
  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  public ApiRole hostRef(ApiHostRef hostRef) {
    this.hostRef = hostRef;
    return this;
  }

   /**
   * Get hostRef
   * @return hostRef
  **/
  @Schema(description = "")
  public ApiHostRef getHostRef() {
    return hostRef;
  }

  public void setHostRef(ApiHostRef hostRef) {
    this.hostRef = hostRef;
  }

  public ApiRole serviceRef(ApiServiceRef serviceRef) {
    this.serviceRef = serviceRef;
    return this;
  }

   /**
   * Get serviceRef
   * @return serviceRef
  **/
  @Schema(description = "")
  public ApiServiceRef getServiceRef() {
    return serviceRef;
  }

  public void setServiceRef(ApiServiceRef serviceRef) {
    this.serviceRef = serviceRef;
  }

  public ApiRole roleState(ApiRoleState roleState) {
    this.roleState = roleState;
    return this;
  }

   /**
   * Get roleState
   * @return roleState
  **/
  @Schema(description = "")
  public ApiRoleState getRoleState() {
    return roleState;
  }

  public void setRoleState(ApiRoleState roleState) {
    this.roleState = roleState;
  }

  public ApiRole commissionState(ApiCommissionState commissionState) {
    this.commissionState = commissionState;
    return this;
  }

   /**
   * Get commissionState
   * @return commissionState
  **/
  @Schema(description = "")
  public ApiCommissionState getCommissionState() {
    return commissionState;
  }

  public void setCommissionState(ApiCommissionState commissionState) {
    this.commissionState = commissionState;
  }

  public ApiRole healthSummary(ApiHealthSummary healthSummary) {
    this.healthSummary = healthSummary;
    return this;
  }

   /**
   * Get healthSummary
   * @return healthSummary
  **/
  @Schema(description = "")
  public ApiHealthSummary getHealthSummary() {
    return healthSummary;
  }

  public void setHealthSummary(ApiHealthSummary healthSummary) {
    this.healthSummary = healthSummary;
  }

  public ApiRole configStale(Boolean configStale) {
    this.configStale = configStale;
    return this;
  }

   /**
   * Readonly. Expresses whether the role configuration is stale.
   * @return configStale
  **/
  @Schema(description = "Readonly. Expresses whether the role configuration is stale.")
  public Boolean isConfigStale() {
    return configStale;
  }

  public void setConfigStale(Boolean configStale) {
    this.configStale = configStale;
  }

  public ApiRole configStalenessStatus(ApiConfigStalenessStatus configStalenessStatus) {
    this.configStalenessStatus = configStalenessStatus;
    return this;
  }

   /**
   * Get configStalenessStatus
   * @return configStalenessStatus
  **/
  @Schema(description = "")
  public ApiConfigStalenessStatus getConfigStalenessStatus() {
    return configStalenessStatus;
  }

  public void setConfigStalenessStatus(ApiConfigStalenessStatus configStalenessStatus) {
    this.configStalenessStatus = configStalenessStatus;
  }

  public ApiRole healthChecks(List<ApiHealthCheck> healthChecks) {
    this.healthChecks = healthChecks;
    return this;
  }

  public ApiRole addHealthChecksItem(ApiHealthCheck healthChecksItem) {
    if (this.healthChecks == null) {
      this.healthChecks = new ArrayList<>();
    }
    this.healthChecks.add(healthChecksItem);
    return this;
  }

   /**
   * Readonly. The list of health checks of this service.
   * @return healthChecks
  **/
  @Schema(description = "Readonly. The list of health checks of this service.")
  public List<ApiHealthCheck> getHealthChecks() {
    return healthChecks;
  }

  public void setHealthChecks(List<ApiHealthCheck> healthChecks) {
    this.healthChecks = healthChecks;
  }

  public ApiRole haStatus(HaStatus haStatus) {
    this.haStatus = haStatus;
    return this;
  }

   /**
   * Get haStatus
   * @return haStatus
  **/
  @Schema(description = "")
  public HaStatus getHaStatus() {
    return haStatus;
  }

  public void setHaStatus(HaStatus haStatus) {
    this.haStatus = haStatus;
  }

  public ApiRole roleUrl(String roleUrl) {
    this.roleUrl = roleUrl;
    return this;
  }

   /**
   * Readonly. Link into the Cloudera Manager web UI for this specific role.
   * @return roleUrl
  **/
  @Schema(description = "Readonly. Link into the Cloudera Manager web UI for this specific role.")
  public String getRoleUrl() {
    return roleUrl;
  }

  public void setRoleUrl(String roleUrl) {
    this.roleUrl = roleUrl;
  }

  public ApiRole maintenanceMode(Boolean maintenanceMode) {
    this.maintenanceMode = maintenanceMode;
    return this;
  }

   /**
   * Readonly. Whether the role is in maintenance mode. Available since API v2.
   * @return maintenanceMode
  **/
  @Schema(description = "Readonly. Whether the role is in maintenance mode. Available since API v2.")
  public Boolean isMaintenanceMode() {
    return maintenanceMode;
  }

  public void setMaintenanceMode(Boolean maintenanceMode) {
    this.maintenanceMode = maintenanceMode;
  }

  public ApiRole maintenanceOwners(List<ApiEntityType> maintenanceOwners) {
    this.maintenanceOwners = maintenanceOwners;
    return this;
  }

  public ApiRole addMaintenanceOwnersItem(ApiEntityType maintenanceOwnersItem) {
    if (this.maintenanceOwners == null) {
      this.maintenanceOwners = new ArrayList<>();
    }
    this.maintenanceOwners.add(maintenanceOwnersItem);
    return this;
  }

   /**
   * Readonly. The list of objects that trigger this role to be in maintenance mode. Available since API v2.
   * @return maintenanceOwners
  **/
  @Schema(description = "Readonly. The list of objects that trigger this role to be in maintenance mode. Available since API v2.")
  public List<ApiEntityType> getMaintenanceOwners() {
    return maintenanceOwners;
  }

  public void setMaintenanceOwners(List<ApiEntityType> maintenanceOwners) {
    this.maintenanceOwners = maintenanceOwners;
  }

  public ApiRole config(ApiConfigList config) {
    this.config = config;
    return this;
  }

   /**
   * Get config
   * @return config
  **/
  @Schema(description = "")
  public ApiConfigList getConfig() {
    return config;
  }

  public void setConfig(ApiConfigList config) {
    this.config = config;
  }

  public ApiRole roleConfigGroupRef(ApiRoleConfigGroupRef roleConfigGroupRef) {
    this.roleConfigGroupRef = roleConfigGroupRef;
    return this;
  }

   /**
   * Get roleConfigGroupRef
   * @return roleConfigGroupRef
  **/
  @Schema(description = "")
  public ApiRoleConfigGroupRef getRoleConfigGroupRef() {
    return roleConfigGroupRef;
  }

  public void setRoleConfigGroupRef(ApiRoleConfigGroupRef roleConfigGroupRef) {
    this.roleConfigGroupRef = roleConfigGroupRef;
  }

  public ApiRole zooKeeperServerMode(ZooKeeperServerMode zooKeeperServerMode) {
    this.zooKeeperServerMode = zooKeeperServerMode;
    return this;
  }

   /**
   * Get zooKeeperServerMode
   * @return zooKeeperServerMode
  **/
  @Schema(description = "")
  public ZooKeeperServerMode getZooKeeperServerMode() {
    return zooKeeperServerMode;
  }

  public void setZooKeeperServerMode(ZooKeeperServerMode zooKeeperServerMode) {
    this.zooKeeperServerMode = zooKeeperServerMode;
  }

  public ApiRole entityStatus(ApiEntityStatus entityStatus) {
    this.entityStatus = entityStatus;
    return this;
  }

   /**
   * Get entityStatus
   * @return entityStatus
  **/
  @Schema(description = "")
  public ApiEntityStatus getEntityStatus() {
    return entityStatus;
  }

  public void setEntityStatus(ApiEntityStatus entityStatus) {
    this.entityStatus = entityStatus;
  }

  public ApiRole tags(List<ApiEntityTag> tags) {
    this.tags = tags;
    return this;
  }

  public ApiRole addTagsItem(ApiEntityTag tagsItem) {
    if (this.tags == null) {
      this.tags = new ArrayList<>();
    }
    this.tags.add(tagsItem);
    return this;
  }

   /**
   * Tags associated with the role. Available since V41.
   * @return tags
  **/
  @Schema(description = "Tags associated with the role. Available since V41.")
  public List<ApiEntityTag> getTags() {
    return tags;
  }

  public void setTags(List<ApiEntityTag> tags) {
    this.tags = tags;
  }


  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ApiRole apiRole = (ApiRole) o;
    return Objects.equals(this.name, apiRole.name) &&
        Objects.equals(this.type, apiRole.type) &&
        Objects.equals(this.hostRef, apiRole.hostRef) &&
        Objects.equals(this.serviceRef, apiRole.serviceRef) &&
        Objects.equals(this.roleState, apiRole.roleState) &&
        Objects.equals(this.commissionState, apiRole.commissionState) &&
        Objects.equals(this.healthSummary, apiRole.healthSummary) &&
        Objects.equals(this.configStale, apiRole.configStale) &&
        Objects.equals(this.configStalenessStatus, apiRole.configStalenessStatus) &&
        Objects.equals(this.healthChecks, apiRole.healthChecks) &&
        Objects.equals(this.haStatus, apiRole.haStatus) &&
        Objects.equals(this.roleUrl, apiRole.roleUrl) &&
        Objects.equals(this.maintenanceMode, apiRole.maintenanceMode) &&
        Objects.equals(this.maintenanceOwners, apiRole.maintenanceOwners) &&
        Objects.equals(this.config, apiRole.config) &&
        Objects.equals(this.roleConfigGroupRef, apiRole.roleConfigGroupRef) &&
        Objects.equals(this.zooKeeperServerMode, apiRole.zooKeeperServerMode) &&
        Objects.equals(this.entityStatus, apiRole.entityStatus) &&
        Objects.equals(this.tags, apiRole.tags);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, type, hostRef, serviceRef, roleState, commissionState, healthSummary, configStale, configStalenessStatus, healthChecks, haStatus, roleUrl, maintenanceMode, maintenanceOwners, config, roleConfigGroupRef, zooKeeperServerMode, entityStatus, tags);
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ApiRole {\n");
    
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    hostRef: ").append(toIndentedString(hostRef)).append("\n");
    sb.append("    serviceRef: ").append(toIndentedString(serviceRef)).append("\n");
    sb.append("    roleState: ").append(toIndentedString(roleState)).append("\n");
    sb.append("    commissionState: ").append(toIndentedString(commissionState)).append("\n");
    sb.append("    healthSummary: ").append(toIndentedString(healthSummary)).append("\n");
    sb.append("    configStale: ").append(toIndentedString(configStale)).append("\n");
    sb.append("    configStalenessStatus: ").append(toIndentedString(configStalenessStatus)).append("\n");
    sb.append("    healthChecks: ").append(toIndentedString(healthChecks)).append("\n");
    sb.append("    haStatus: ").append(toIndentedString(haStatus)).append("\n");
    sb.append("    roleUrl: ").append(toIndentedString(roleUrl)).append("\n");
    sb.append("    maintenanceMode: ").append(toIndentedString(maintenanceMode)).append("\n");
    sb.append("    maintenanceOwners: ").append(toIndentedString(maintenanceOwners)).append("\n");
    sb.append("    config: ").append(toIndentedString(config)).append("\n");
    sb.append("    roleConfigGroupRef: ").append(toIndentedString(roleConfigGroupRef)).append("\n");
    sb.append("    zooKeeperServerMode: ").append(toIndentedString(zooKeeperServerMode)).append("\n");
    sb.append("    entityStatus: ").append(toIndentedString(entityStatus)).append("\n");
    sb.append("    tags: ").append(toIndentedString(tags)).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    ");
  }

}
