/*
 * 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.HashMap;
import java.util.List;
import java.util.Map;
import org.appng.openapi.model.FieldValue;
import org.appng.openapi.model.Link;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
 * A single item of a page.
 */
@ApiModel(description = "A single item of a page.")
@JsonPropertyOrder({
  Item.JSON_PROPERTY_FIELDS,
  Item.JSON_PROPERTY_SELECTED,
  Item.JSON_PROPERTY_LINKS
})
@JsonTypeName("Item")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-09-06T11:11:26.226947+02:00[Europe/Berlin]")
public class Item {
  public static final String JSON_PROPERTY_FIELDS = "fields";
  private Map<String, FieldValue> fields = null;

  public static final String JSON_PROPERTY_SELECTED = "selected";
  private Boolean selected;

  public static final String JSON_PROPERTY_LINKS = "links";
  private List<Link> links = null;


  public Item fields(Map<String, FieldValue> fields) {
    
    this.fields = fields;
    return this;
  }

  public Item putFieldsItem(String key, FieldValue fieldsItem) {
    if (this.fields == null) {
      this.fields = new HashMap<>();
    }
    this.fields.put(key, fieldsItem);
    return this;
  }

   /**
   * The list of field-values of the item.
   * @return fields
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The list of field-values of the item.")
  @JsonProperty(JSON_PROPERTY_FIELDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Map<String, FieldValue> getFields() {
    return fields;
  }


  @JsonProperty(JSON_PROPERTY_FIELDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFields(Map<String, FieldValue> fields) {
    this.fields = fields;
  }


  public Item selected(Boolean selected) {
    
    this.selected = selected;
    return this;
  }

   /**
   * Whether this item is selected/active.
   * @return selected
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Whether this item is selected/active.")
  @JsonProperty(JSON_PROPERTY_SELECTED)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Boolean getSelected() {
    return selected;
  }


  @JsonProperty(JSON_PROPERTY_SELECTED)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setSelected(Boolean selected) {
    this.selected = selected;
  }


  public Item links(List<Link> links) {
    
    this.links = links;
    return this;
  }

  public Item addLinksItem(Link linksItem) {
    if (this.links == null) {
      this.links = new ArrayList<>();
    }
    this.links.add(linksItem);
    return this;
  }

   /**
   * A list of links.
   * @return links
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "A list of links.")
  @JsonProperty(JSON_PROPERTY_LINKS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<Link> getLinks() {
    return links;
  }


  @JsonProperty(JSON_PROPERTY_LINKS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setLinks(List<Link> links) {
    this.links = links;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Item item = (Item) o;
    return Objects.equals(this.fields, item.fields) &&
        Objects.equals(this.selected, item.selected) &&
        Objects.equals(this.links, item.links);
  }

  @Override
  public int hashCode() {
    return Objects.hash(fields, selected, links);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Item {\n");
    sb.append("    fields: ").append(toIndentedString(fields)).append("\n");
    sb.append("    selected: ").append(toIndentedString(selected)).append("\n");
    sb.append("    links: ").append(toIndentedString(links)).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    ");
  }

}

