/*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package io.kubernetes.client.openapi.models;

import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;
import org.joda.time.DateTime;

/**
 * ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the
 * fieldset applies to.
 */
@ApiModel(
    description =
        "ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to.")
@javax.annotation.Generated(
    value = "org.openapitools.codegen.languages.JavaClientCodegen",
    date = "2020-06-19T10:47:33.387Z[Etc/UTC]")
public class V1ManagedFieldsEntry {
  public static final String SERIALIZED_NAME_API_VERSION = "apiVersion";

  @SerializedName(SERIALIZED_NAME_API_VERSION)
  private String apiVersion;

  public static final String SERIALIZED_NAME_FIELDS_TYPE = "fieldsType";

  @SerializedName(SERIALIZED_NAME_FIELDS_TYPE)
  private String fieldsType;

  public static final String SERIALIZED_NAME_FIELDS_V1 = "fieldsV1";

  @SerializedName(SERIALIZED_NAME_FIELDS_V1)
  private Object fieldsV1;

  public static final String SERIALIZED_NAME_MANAGER = "manager";

  @SerializedName(SERIALIZED_NAME_MANAGER)
  private String manager;

  public static final String SERIALIZED_NAME_OPERATION = "operation";

  @SerializedName(SERIALIZED_NAME_OPERATION)
  private String operation;

  public static final String SERIALIZED_NAME_TIME = "time";

  @SerializedName(SERIALIZED_NAME_TIME)
  private DateTime time;

  public V1ManagedFieldsEntry apiVersion(String apiVersion) {

    this.apiVersion = apiVersion;
    return this;
  }

  /**
   * APIVersion defines the version of this resource that this field set applies to. The format is
   * \&quot;group/version\&quot; just like the top-level APIVersion field. It is necessary to track
   * the version of a field set because it cannot be automatically converted.
   *
   * @return apiVersion
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value =
          "APIVersion defines the version of this resource that this field set applies to. The format is \"group/version\" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted.")
  public String getApiVersion() {
    return apiVersion;
  }

  public void setApiVersion(String apiVersion) {
    this.apiVersion = apiVersion;
  }

  public V1ManagedFieldsEntry fieldsType(String fieldsType) {

    this.fieldsType = fieldsType;
    return this;
  }

  /**
   * FieldsType is the discriminator for the different fields format and version. There is currently
   * only one possible value: \&quot;FieldsV1\&quot;
   *
   * @return fieldsType
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value =
          "FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: \"FieldsV1\"")
  public String getFieldsType() {
    return fieldsType;
  }

  public void setFieldsType(String fieldsType) {
    this.fieldsType = fieldsType;
  }

  public V1ManagedFieldsEntry fieldsV1(Object fieldsV1) {

    this.fieldsV1 = fieldsV1;
    return this;
  }

  /**
   * FieldsV1 holds the first JSON version format as described in the \&quot;FieldsV1\&quot; type.
   *
   * @return fieldsV1
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value = "FieldsV1 holds the first JSON version format as described in the \"FieldsV1\" type.")
  public Object getFieldsV1() {
    return fieldsV1;
  }

  public void setFieldsV1(Object fieldsV1) {
    this.fieldsV1 = fieldsV1;
  }

  public V1ManagedFieldsEntry manager(String manager) {

    this.manager = manager;
    return this;
  }

  /**
   * Manager is an identifier of the workflow managing these fields.
   *
   * @return manager
   */
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Manager is an identifier of the workflow managing these fields.")
  public String getManager() {
    return manager;
  }

  public void setManager(String manager) {
    this.manager = manager;
  }

  public V1ManagedFieldsEntry operation(String operation) {

    this.operation = operation;
    return this;
  }

  /**
   * Operation is the type of operation which lead to this ManagedFieldsEntry being created. The
   * only valid values for this field are &#39;Apply&#39; and &#39;Update&#39;.
   *
   * @return operation
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value =
          "Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'.")
  public String getOperation() {
    return operation;
  }

  public void setOperation(String operation) {
    this.operation = operation;
  }

  public V1ManagedFieldsEntry time(DateTime time) {

    this.time = time;
    return this;
  }

  /**
   * Time is timestamp of when these fields were set. It should always be empty if Operation is
   * &#39;Apply&#39;
   *
   * @return time
   */
  @javax.annotation.Nullable
  @ApiModelProperty(
      value =
          "Time is timestamp of when these fields were set. It should always be empty if Operation is 'Apply'")
  public DateTime getTime() {
    return time;
  }

  public void setTime(DateTime time) {
    this.time = time;
  }

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    V1ManagedFieldsEntry v1ManagedFieldsEntry = (V1ManagedFieldsEntry) o;
    return Objects.equals(this.apiVersion, v1ManagedFieldsEntry.apiVersion)
        && Objects.equals(this.fieldsType, v1ManagedFieldsEntry.fieldsType)
        && Objects.equals(this.fieldsV1, v1ManagedFieldsEntry.fieldsV1)
        && Objects.equals(this.manager, v1ManagedFieldsEntry.manager)
        && Objects.equals(this.operation, v1ManagedFieldsEntry.operation)
        && Objects.equals(this.time, v1ManagedFieldsEntry.time);
  }

  @Override
  public int hashCode() {
    return Objects.hash(apiVersion, fieldsType, fieldsV1, manager, operation, time);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class V1ManagedFieldsEntry {\n");
    sb.append("    apiVersion: ").append(toIndentedString(apiVersion)).append("\n");
    sb.append("    fieldsType: ").append(toIndentedString(fieldsType)).append("\n");
    sb.append("    fieldsV1: ").append(toIndentedString(fieldsV1)).append("\n");
    sb.append("    manager: ").append(toIndentedString(manager)).append("\n");
    sb.append("    operation: ").append(toIndentedString(operation)).append("\n");
    sb.append("    time: ").append(toIndentedString(time)).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    ");
  }
}
