/*
 * 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.Field;
import org.appng.openapi.model.Filter;
import org.appng.openapi.model.Item;
import org.appng.openapi.model.Link;
import org.appng.openapi.model.Message;
import org.appng.openapi.model.Page;
import org.appng.openapi.model.Permission;
import org.appng.openapi.model.User;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
 * A datasource, represented by either a page (of elements) or a single element.
 */
@ApiModel(description = "A datasource, represented by either a page (of elements) or a single element.")
@JsonPropertyOrder({
  Datasource.JSON_PROPERTY_SELF,
  Datasource.JSON_PROPERTY_ID,
  Datasource.JSON_PROPERTY_TITLE,
  Datasource.JSON_PROPERTY_PARAMETERS,
  Datasource.JSON_PROPERTY_USER,
  Datasource.JSON_PROPERTY_LINKS,
  Datasource.JSON_PROPERTY_MESSAGES,
  Datasource.JSON_PROPERTY_FIELDS,
  Datasource.JSON_PROPERTY_FILTERS,
  Datasource.JSON_PROPERTY_FILTER_RESET_PATH,
  Datasource.JSON_PROPERTY_PAGE,
  Datasource.JSON_PROPERTY_ITEM,
  Datasource.JSON_PROPERTY_ITEMS,
  Datasource.JSON_PROPERTY_PERMISSIONS,
  Datasource.JSON_PROPERTY_APP_N_G_VERSION,
  Datasource.JSON_PROPERTY_APP_VERSION
})
@JsonTypeName("Datasource")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-03-20T12:57:48.851+01:00[Europe/Berlin]")
public class Datasource {
  public static final String JSON_PROPERTY_SELF = "_self";
  private String self;

  public static final String JSON_PROPERTY_ID = "id";
  private String id;

  public static final String JSON_PROPERTY_TITLE = "title";
  private String title;

  public static final String JSON_PROPERTY_PARAMETERS = "parameters";
  private Map<String, String> parameters = null;

  public static final String JSON_PROPERTY_USER = "user";
  private User user;

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

  public static final String JSON_PROPERTY_MESSAGES = "messages";
  private List<Message> messages = null;

  public static final String JSON_PROPERTY_FIELDS = "fields";
  private List<Field> fields = null;

  public static final String JSON_PROPERTY_FILTERS = "filters";
  private List<Filter> filters = null;

  public static final String JSON_PROPERTY_FILTER_RESET_PATH = "filterResetPath";
  private String filterResetPath;

  public static final String JSON_PROPERTY_PAGE = "page";
  private Page page;

  public static final String JSON_PROPERTY_ITEM = "item";
  private Item item;

  public static final String JSON_PROPERTY_ITEMS = "items";
  private List<Item> items = null;

  public static final String JSON_PROPERTY_PERMISSIONS = "permissions";
  private List<Permission> permissions = null;

  public static final String JSON_PROPERTY_APP_N_G_VERSION = "appNGVersion";
  private String appNGVersion = null;

  public static final String JSON_PROPERTY_APP_VERSION = "appVersion";
  private String appVersion = null;


  public Datasource self(String self) {
    
    this.self = self;
    return this;
  }

   /**
   * The URL of the datasource
   * @return self
  **/
  @ApiModelProperty(required = true, value = "The URL of the datasource")
  @JsonProperty(JSON_PROPERTY_SELF)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getSelf() {
    return self;
  }


  @JsonProperty(JSON_PROPERTY_SELF)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setSelf(String self) {
    this.self = self;
  }


  public Datasource id(String id) {
    
    this.id = id;
    return this;
  }

   /**
   * The unique ID of the datasource.
   * @return id
  **/
  @ApiModelProperty(required = true, value = "The unique ID of the datasource.")
  @JsonProperty(JSON_PROPERTY_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getId() {
    return id;
  }


  @JsonProperty(JSON_PROPERTY_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setId(String id) {
    this.id = id;
  }


  public Datasource title(String title) {
    
    this.title = title;
    return this;
  }

   /**
   * The title of the datasource.
   * @return title
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The title of the datasource.")
  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getTitle() {
    return title;
  }


  @JsonProperty(JSON_PROPERTY_TITLE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setTitle(String title) {
    this.title = title;
  }


  public Datasource parameters(Map<String, String> parameters) {
    
    this.parameters = parameters;
    return this;
  }

  public Datasource putParametersItem(String key, String parametersItem) {
    if (this.parameters == null) {
      this.parameters = new HashMap<>();
    }
    this.parameters.put(key, parametersItem);
    return this;
  }

   /**
   * The parameters for the datasource.
   * @return parameters
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The parameters for the datasource.")
  @JsonProperty(JSON_PROPERTY_PARAMETERS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Map<String, String> getParameters() {
    return parameters;
  }


  @JsonProperty(JSON_PROPERTY_PARAMETERS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setParameters(Map<String, String> parameters) {
    this.parameters = parameters;
  }


  public Datasource user(User user) {
    
    this.user = user;
    return this;
  }

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

  public User getUser() {
    return user;
  }


  @JsonProperty(JSON_PROPERTY_USER)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setUser(User user) {
    this.user = user;
  }


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

  public Datasource 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;
  }


  public Datasource messages(List<Message> messages) {
    
    this.messages = messages;
    return this;
  }

  public Datasource addMessagesItem(Message messagesItem) {
    if (this.messages == null) {
      this.messages = new ArrayList<>();
    }
    this.messages.add(messagesItem);
    return this;
  }

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

  public List<Message> getMessages() {
    return messages;
  }


  @JsonProperty(JSON_PROPERTY_MESSAGES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMessages(List<Message> messages) {
    this.messages = messages;
  }


  public Datasource fields(List<Field> fields) {
    
    this.fields = fields;
    return this;
  }

  public Datasource addFieldsItem(Field fieldsItem) {
    if (this.fields == null) {
      this.fields = new ArrayList<>();
    }
    this.fields.add(fieldsItem);
    return this;
  }

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

  public List<Field> getFields() {
    return fields;
  }


  @JsonProperty(JSON_PROPERTY_FIELDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFields(List<Field> fields) {
    this.fields = fields;
  }


  public Datasource filters(List<Filter> filters) {
    
    this.filters = filters;
    return this;
  }

  public Datasource addFiltersItem(Filter filtersItem) {
    if (this.filters == null) {
      this.filters = new ArrayList<>();
    }
    this.filters.add(filtersItem);
    return this;
  }

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

  public List<Filter> getFilters() {
    return filters;
  }


  @JsonProperty(JSON_PROPERTY_FILTERS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFilters(List<Filter> filters) {
    this.filters = filters;
  }


  public Datasource filterResetPath(String filterResetPath) {
    
    this.filterResetPath = filterResetPath;
    return this;
  }

   /**
   * the path to be called to reset the filter
   * @return filterResetPath
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "the path to be called to reset the filter")
  @JsonProperty(JSON_PROPERTY_FILTER_RESET_PATH)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getFilterResetPath() {
    return filterResetPath;
  }


  @JsonProperty(JSON_PROPERTY_FILTER_RESET_PATH)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFilterResetPath(String filterResetPath) {
    this.filterResetPath = filterResetPath;
  }


  public Datasource page(Page page) {
    
    this.page = page;
    return this;
  }

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

  public Page getPage() {
    return page;
  }


  @JsonProperty(JSON_PROPERTY_PAGE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setPage(Page page) {
    this.page = page;
  }


  public Datasource item(Item item) {
    
    this.item = item;
    return this;
  }

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

  public Item getItem() {
    return item;
  }


  @JsonProperty(JSON_PROPERTY_ITEM)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setItem(Item item) {
    this.item = item;
  }


  public Datasource items(List<Item> items) {
    
    this.items = items;
    return this;
  }

  public Datasource addItemsItem(Item itemsItem) {
    if (this.items == null) {
      this.items = new ArrayList<>();
    }
    this.items.add(itemsItem);
    return this;
  }

   /**
   * The items of this page.
   * @return items
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The items of this page.")
  @JsonProperty(JSON_PROPERTY_ITEMS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<Item> getItems() {
    return items;
  }


  @JsonProperty(JSON_PROPERTY_ITEMS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setItems(List<Item> items) {
    this.items = items;
  }


  public Datasource permissions(List<Permission> permissions) {
    
    this.permissions = permissions;
    return this;
  }

  public Datasource addPermissionsItem(Permission permissionsItem) {
    if (this.permissions == null) {
      this.permissions = new ArrayList<>();
    }
    this.permissions.add(permissionsItem);
    return this;
  }

   /**
   * The permissions for this datasource.
   * @return permissions
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The permissions for this datasource.")
  @JsonProperty(JSON_PROPERTY_PERMISSIONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List<Permission> getPermissions() {
    return permissions;
  }


  @JsonProperty(JSON_PROPERTY_PERMISSIONS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setPermissions(List<Permission> permissions) {
    this.permissions = permissions;
  }


  public Datasource appNGVersion(String appNGVersion) {
    
    this.appNGVersion = appNGVersion;
    return this;
  }

   /**
   * The version of appNG
   * @return appNGVersion
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The version of appNG")
  @JsonProperty(JSON_PROPERTY_APP_N_G_VERSION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getAppNGVersion() {
    return appNGVersion;
  }


  @JsonProperty(JSON_PROPERTY_APP_N_G_VERSION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setAppNGVersion(String appNGVersion) {
    this.appNGVersion = appNGVersion;
  }


  public Datasource appVersion(String appVersion) {
    
    this.appVersion = appVersion;
    return this;
  }

   /**
   * The version of the application
   * @return appVersion
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The version of the application")
  @JsonProperty(JSON_PROPERTY_APP_VERSION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getAppVersion() {
    return appVersion;
  }


  @JsonProperty(JSON_PROPERTY_APP_VERSION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setAppVersion(String appVersion) {
    this.appVersion = appVersion;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Datasource datasource = (Datasource) o;
    return Objects.equals(this.self, datasource.self) &&
        Objects.equals(this.id, datasource.id) &&
        Objects.equals(this.title, datasource.title) &&
        Objects.equals(this.parameters, datasource.parameters) &&
        Objects.equals(this.user, datasource.user) &&
        Objects.equals(this.links, datasource.links) &&
        Objects.equals(this.messages, datasource.messages) &&
        Objects.equals(this.fields, datasource.fields) &&
        Objects.equals(this.filters, datasource.filters) &&
        Objects.equals(this.filterResetPath, datasource.filterResetPath) &&
        Objects.equals(this.page, datasource.page) &&
        Objects.equals(this.item, datasource.item) &&
        Objects.equals(this.items, datasource.items) &&
        Objects.equals(this.permissions, datasource.permissions) &&
        Objects.equals(this.appNGVersion, datasource.appNGVersion) &&
        Objects.equals(this.appVersion, datasource.appVersion);
  }

  @Override
  public int hashCode() {
    return Objects.hash(self, id, title, parameters, user, links, messages, fields, filters, filterResetPath, page, item, items, permissions, appNGVersion, appVersion);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Datasource {\n");
    sb.append("    self: ").append(toIndentedString(self)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    title: ").append(toIndentedString(title)).append("\n");
    sb.append("    parameters: ").append(toIndentedString(parameters)).append("\n");
    sb.append("    user: ").append(toIndentedString(user)).append("\n");
    sb.append("    links: ").append(toIndentedString(links)).append("\n");
    sb.append("    messages: ").append(toIndentedString(messages)).append("\n");
    sb.append("    fields: ").append(toIndentedString(fields)).append("\n");
    sb.append("    filters: ").append(toIndentedString(filters)).append("\n");
    sb.append("    filterResetPath: ").append(toIndentedString(filterResetPath)).append("\n");
    sb.append("    page: ").append(toIndentedString(page)).append("\n");
    sb.append("    item: ").append(toIndentedString(item)).append("\n");
    sb.append("    items: ").append(toIndentedString(items)).append("\n");
    sb.append("    permissions: ").append(toIndentedString(permissions)).append("\n");
    sb.append("    appNGVersion: ").append(toIndentedString(appNGVersion)).append("\n");
    sb.append("    appVersion: ").append(toIndentedString(appVersion)).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    ");
  }

}

