/*
 * appNG REST API
 * The REST API for appNG
 *
 * OpenAPI spec version: 1.0.0
 * Contact: matthias.mueller@appng.org
 *
 * 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 org.appng.api.rest.model;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.appng.api.rest.model.FieldValue;
import java.io.Serializable;

/**
 * The value of a field within a datasource.
 */
@ApiModel(description = "The value of a field within a datasource.")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-03-20T12:57:47.319+01:00")
public class FieldValue implements Serializable {
  private static final long serialVersionUID = 1L;

  @JsonProperty("name")
  private String name = null;

  @JsonProperty("value")
  private Object value = null;

  @JsonProperty("formattedValue")
  private String formattedValue = null;

  @JsonProperty("values")
  private List<FieldValue> values = null;

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

   /**
   * The name of the field.
   * @return name
  **/
  @ApiModelProperty(required = true, value = "The name of the field.")
  public String getName() {
    return name;
  }

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

  public FieldValue value(Object value) {
    this.value = value;
    return this;
  }

   /**
   * The value of the field.
   * @return value
  **/
  @ApiModelProperty(value = "The value of the field.")
  public Object getValue() {
    return value;
  }

  public void setValue(Object value) {
    this.value = value;
  }

  public FieldValue formattedValue(String formattedValue) {
    this.formattedValue = formattedValue;
    return this;
  }

   /**
   * The formatted value of the field.
   * @return formattedValue
  **/
  @ApiModelProperty(value = "The formatted value of the field.")
  public String getFormattedValue() {
    return formattedValue;
  }

  public void setFormattedValue(String formattedValue) {
    this.formattedValue = formattedValue;
  }

  public FieldValue values(List<FieldValue> values) {
    this.values = values;
    return this;
  }

  public FieldValue addValuesItem(FieldValue valuesItem) {
    if (this.values == null) {
      this.values = new ArrayList<FieldValue>();
    }
    this.values.add(valuesItem);
    return this;
  }

   /**
   * The child values of this fieldValue.
   * @return values
  **/
  @ApiModelProperty(value = "The child values of this fieldValue.")
  public List<FieldValue> getValues() {
    return values;
  }

  public void setValues(List<FieldValue> values) {
    this.values = values;
  }


  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    FieldValue fieldValue = (FieldValue) o;
    return Objects.equals(this.name, fieldValue.name) &&
        Objects.equals(this.value, fieldValue.value) &&
        Objects.equals(this.formattedValue, fieldValue.formattedValue) &&
        Objects.equals(this.values, fieldValue.values);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, value, formattedValue, values);
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class FieldValue {\n");
    
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    value: ").append(toIndentedString(value)).append("\n");
    sb.append("    formattedValue: ").append(toIndentedString(formattedValue)).append("\n");
    sb.append("    values: ").append(toIndentedString(values)).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    ");
  }

}

