/*
 * appNG REST API
 * The REST API for appNG
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: matthias.mueller@appng.org
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.appng.openapi.model;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
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.openapi.model.Icon;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
 * The value of a field within a datasource.
 */
@ApiModel(description = "The value of a field within a datasource.")
@JsonPropertyOrder({
  FieldValue.JSON_PROPERTY_NAME,
  FieldValue.JSON_PROPERTY_VALUE,
  FieldValue.JSON_PROPERTY_FORMATTED_VALUE,
  FieldValue.JSON_PROPERTY_ICONS
})
@JsonTypeName("FieldValue")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-09-06T11:11:26.226947+02:00[Europe/Berlin]")
public class FieldValue {
  public static final String JSON_PROPERTY_NAME = "name";
  private String name;

  public static final String JSON_PROPERTY_VALUE = "value";
  private Object value;

  public static final String JSON_PROPERTY_FORMATTED_VALUE = "formattedValue";
  private String formattedValue;

  public static final String JSON_PROPERTY_ICONS = "icons";
  private List<Icon> icons = 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.")
  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getName() {
    return name;
  }


  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setName(String name) {
    this.name = name;
  }


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

   /**
   * The value of the field. This can be a simple string,integer,number or boolean value (for simple FieldTypes),  or an object (namely: an associative array of FieldValues for FieldType.OBJECT) or an array of objects (namely: an array of associative arrays of FieldValues for for FieldType.LIST_OBJECT). 
   * @return value
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The value of the field. This can be a simple string,integer,number or boolean value (for simple FieldTypes),  or an object (namely: an associative array of FieldValues for FieldType.OBJECT) or an array of objects (namely: an array of associative arrays of FieldValues for for FieldType.LIST_OBJECT). ")
  @JsonProperty(JSON_PROPERTY_VALUE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Object getValue() {
    return value;
  }


  @JsonProperty(JSON_PROPERTY_VALUE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setValue(Object value) {
    this.value = value;
  }


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

   /**
   * The formatted value of the field (only applies for \&quot;simple\&quot; FieldTypes).
   * @return formattedValue
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The formatted value of the field (only applies for \"simple\" FieldTypes).")
  @JsonProperty(JSON_PROPERTY_FORMATTED_VALUE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getFormattedValue() {
    return formattedValue;
  }


  @JsonProperty(JSON_PROPERTY_FORMATTED_VALUE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFormattedValue(String formattedValue) {
    this.formattedValue = formattedValue;
  }


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

  public FieldValue addIconsItem(Icon iconsItem) {
    if (this.icons == null) {
      this.icons = new ArrayList<>();
    }
    this.icons.add(iconsItem);
    return this;
  }

   /**
   * Get icons
   * @return icons
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")
  @JsonProperty(JSON_PROPERTY_ICONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<Icon> getIcons() {
    return icons;
  }


  @JsonProperty(JSON_PROPERTY_ICONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setIcons(List<Icon> icons) {
    this.icons = icons;
  }


  @Override
  public boolean equals(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.icons, fieldValue.icons);
  }

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

  @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("    icons: ").append(toIndentedString(icons)).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(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}

