/*
 * Tribufu API
 * REST API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.1.0
 * Contact: contact@tribufu.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.tribufu.generated.models;

import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.tribufu.generated.models.ApplicationType;
import java.io.IOException;
import java.net.URI;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.openapitools.jackson.nullable.JsonNullable;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.tribufu.generated.JSON;

/**
 * Application
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-26T22:04:46.763378600-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class Application {
  public static final String SERIALIZED_NAME_ID = "id";
  @SerializedName(SERIALIZED_NAME_ID)
  @javax.annotation.Nullable
  private String id;

  public static final String SERIALIZED_NAME_NAME = "name";
  @SerializedName(SERIALIZED_NAME_NAME)
  @javax.annotation.Nullable
  private String name;

  public static final String SERIALIZED_NAME_DESCRIPTION = "description";
  @SerializedName(SERIALIZED_NAME_DESCRIPTION)
  @javax.annotation.Nullable
  private String description;

  public static final String SERIALIZED_NAME_TYPE = "type";
  @SerializedName(SERIALIZED_NAME_TYPE)
  @javax.annotation.Nullable
  private ApplicationType type;

  public static final String SERIALIZED_NAME_ORGANIZATION_ID = "organization_id";
  @SerializedName(SERIALIZED_NAME_ORGANIZATION_ID)
  @javax.annotation.Nullable
  private String organizationId;

  public static final String SERIALIZED_NAME_ICON_URL = "icon_url";
  @SerializedName(SERIALIZED_NAME_ICON_URL)
  @javax.annotation.Nullable
  private URI iconUrl;

  public static final String SERIALIZED_NAME_BANNER_URL = "banner_url";
  @SerializedName(SERIALIZED_NAME_BANNER_URL)
  @javax.annotation.Nullable
  private URI bannerUrl;

  public static final String SERIALIZED_NAME_CAPSULE_IMAGE_URL = "capsule_image_url";
  @SerializedName(SERIALIZED_NAME_CAPSULE_IMAGE_URL)
  @javax.annotation.Nullable
  private URI capsuleImageUrl;

  public static final String SERIALIZED_NAME_LIBRARY_IMAGE_URL = "library_image_url";
  @SerializedName(SERIALIZED_NAME_LIBRARY_IMAGE_URL)
  @javax.annotation.Nullable
  private URI libraryImageUrl;

  public static final String SERIALIZED_NAME_PARENT_ID = "parent_id";
  @SerializedName(SERIALIZED_NAME_PARENT_ID)
  @javax.annotation.Nullable
  private String parentId;

  public static final String SERIALIZED_NAME_SLUG = "slug";
  @SerializedName(SERIALIZED_NAME_SLUG)
  @javax.annotation.Nullable
  private String slug;

  public static final String SERIALIZED_NAME_VISIBILITY = "visibility";
  @SerializedName(SERIALIZED_NAME_VISIBILITY)
  @javax.annotation.Nullable
  private Integer visibility;

  public static final String SERIALIZED_NAME_PASSWORD = "password";
  @SerializedName(SERIALIZED_NAME_PASSWORD)
  @javax.annotation.Nullable
  private String password;

  public static final String SERIALIZED_NAME_PRIMARY = "primary";
  @SerializedName(SERIALIZED_NAME_PRIMARY)
  @javax.annotation.Nullable
  private Integer primary;

  public static final String SERIALIZED_NAME_USER_COUNT = "user_count";
  @SerializedName(SERIALIZED_NAME_USER_COUNT)
  @javax.annotation.Nullable
  private Integer userCount;

  public static final String SERIALIZED_NAME_ACHIEVEMENT_COUNT = "achievement_count";
  @SerializedName(SERIALIZED_NAME_ACHIEVEMENT_COUNT)
  @javax.annotation.Nullable
  private Integer achievementCount;

  public static final String SERIALIZED_NAME_BADGE_COUNT = "badge_count";
  @SerializedName(SERIALIZED_NAME_BADGE_COUNT)
  @javax.annotation.Nullable
  private Integer badgeCount;

  public static final String SERIALIZED_NAME_DOWNLOAD_COUNT = "download_count";
  @SerializedName(SERIALIZED_NAME_DOWNLOAD_COUNT)
  @javax.annotation.Nullable
  private Integer downloadCount;

  public static final String SERIALIZED_NAME_CREATED = "created";
  @SerializedName(SERIALIZED_NAME_CREATED)
  @javax.annotation.Nullable
  private OffsetDateTime created;

  public static final String SERIALIZED_NAME_UPDATED = "updated";
  @SerializedName(SERIALIZED_NAME_UPDATED)
  @javax.annotation.Nullable
  private OffsetDateTime updated;

  public Application() {
  }

  public Application id(@javax.annotation.Nullable String id) {
    this.id = id;
    return this;
  }

  /**
   * Get id
   * @return id
   */
  @javax.annotation.Nullable
  public String getId() {
    return id;
  }

  public void setId(@javax.annotation.Nullable String id) {
    this.id = id;
  }


  public Application name(@javax.annotation.Nullable String name) {
    this.name = name;
    return this;
  }

  /**
   * Get name
   * @return name
   */
  @javax.annotation.Nullable
  public String getName() {
    return name;
  }

  public void setName(@javax.annotation.Nullable String name) {
    this.name = name;
  }


  public Application description(@javax.annotation.Nullable String description) {
    this.description = description;
    return this;
  }

  /**
   * Get description
   * @return description
   */
  @javax.annotation.Nullable
  public String getDescription() {
    return description;
  }

  public void setDescription(@javax.annotation.Nullable String description) {
    this.description = description;
  }


  public Application type(@javax.annotation.Nullable ApplicationType type) {
    this.type = type;
    return this;
  }

  /**
   * Get type
   * @return type
   */
  @javax.annotation.Nullable
  public ApplicationType getType() {
    return type;
  }

  public void setType(@javax.annotation.Nullable ApplicationType type) {
    this.type = type;
  }


  public Application organizationId(@javax.annotation.Nullable String organizationId) {
    this.organizationId = organizationId;
    return this;
  }

  /**
   * Get organizationId
   * @return organizationId
   */
  @javax.annotation.Nullable
  public String getOrganizationId() {
    return organizationId;
  }

  public void setOrganizationId(@javax.annotation.Nullable String organizationId) {
    this.organizationId = organizationId;
  }


  public Application iconUrl(@javax.annotation.Nullable URI iconUrl) {
    this.iconUrl = iconUrl;
    return this;
  }

  /**
   * Get iconUrl
   * @return iconUrl
   */
  @javax.annotation.Nullable
  public URI getIconUrl() {
    return iconUrl;
  }

  public void setIconUrl(@javax.annotation.Nullable URI iconUrl) {
    this.iconUrl = iconUrl;
  }


  public Application bannerUrl(@javax.annotation.Nullable URI bannerUrl) {
    this.bannerUrl = bannerUrl;
    return this;
  }

  /**
   * Get bannerUrl
   * @return bannerUrl
   */
  @javax.annotation.Nullable
  public URI getBannerUrl() {
    return bannerUrl;
  }

  public void setBannerUrl(@javax.annotation.Nullable URI bannerUrl) {
    this.bannerUrl = bannerUrl;
  }


  public Application capsuleImageUrl(@javax.annotation.Nullable URI capsuleImageUrl) {
    this.capsuleImageUrl = capsuleImageUrl;
    return this;
  }

  /**
   * Get capsuleImageUrl
   * @return capsuleImageUrl
   */
  @javax.annotation.Nullable
  public URI getCapsuleImageUrl() {
    return capsuleImageUrl;
  }

  public void setCapsuleImageUrl(@javax.annotation.Nullable URI capsuleImageUrl) {
    this.capsuleImageUrl = capsuleImageUrl;
  }


  public Application libraryImageUrl(@javax.annotation.Nullable URI libraryImageUrl) {
    this.libraryImageUrl = libraryImageUrl;
    return this;
  }

  /**
   * Get libraryImageUrl
   * @return libraryImageUrl
   */
  @javax.annotation.Nullable
  public URI getLibraryImageUrl() {
    return libraryImageUrl;
  }

  public void setLibraryImageUrl(@javax.annotation.Nullable URI libraryImageUrl) {
    this.libraryImageUrl = libraryImageUrl;
  }


  public Application parentId(@javax.annotation.Nullable String parentId) {
    this.parentId = parentId;
    return this;
  }

  /**
   * Get parentId
   * @return parentId
   */
  @javax.annotation.Nullable
  public String getParentId() {
    return parentId;
  }

  public void setParentId(@javax.annotation.Nullable String parentId) {
    this.parentId = parentId;
  }


  public Application slug(@javax.annotation.Nullable String slug) {
    this.slug = slug;
    return this;
  }

  /**
   * Get slug
   * @return slug
   */
  @javax.annotation.Nullable
  public String getSlug() {
    return slug;
  }

  public void setSlug(@javax.annotation.Nullable String slug) {
    this.slug = slug;
  }


  public Application visibility(@javax.annotation.Nullable Integer visibility) {
    this.visibility = visibility;
    return this;
  }

  /**
   * Get visibility
   * @return visibility
   */
  @javax.annotation.Nullable
  public Integer getVisibility() {
    return visibility;
  }

  public void setVisibility(@javax.annotation.Nullable Integer visibility) {
    this.visibility = visibility;
  }


  public Application password(@javax.annotation.Nullable String password) {
    this.password = password;
    return this;
  }

  /**
   * Get password
   * @return password
   */
  @javax.annotation.Nullable
  public String getPassword() {
    return password;
  }

  public void setPassword(@javax.annotation.Nullable String password) {
    this.password = password;
  }


  public Application primary(@javax.annotation.Nullable Integer primary) {
    this.primary = primary;
    return this;
  }

  /**
   * Get primary
   * @return primary
   */
  @javax.annotation.Nullable
  public Integer getPrimary() {
    return primary;
  }

  public void setPrimary(@javax.annotation.Nullable Integer primary) {
    this.primary = primary;
  }


  public Application userCount(@javax.annotation.Nullable Integer userCount) {
    this.userCount = userCount;
    return this;
  }

  /**
   * Get userCount
   * @return userCount
   */
  @javax.annotation.Nullable
  public Integer getUserCount() {
    return userCount;
  }

  public void setUserCount(@javax.annotation.Nullable Integer userCount) {
    this.userCount = userCount;
  }


  public Application achievementCount(@javax.annotation.Nullable Integer achievementCount) {
    this.achievementCount = achievementCount;
    return this;
  }

  /**
   * Get achievementCount
   * @return achievementCount
   */
  @javax.annotation.Nullable
  public Integer getAchievementCount() {
    return achievementCount;
  }

  public void setAchievementCount(@javax.annotation.Nullable Integer achievementCount) {
    this.achievementCount = achievementCount;
  }


  public Application badgeCount(@javax.annotation.Nullable Integer badgeCount) {
    this.badgeCount = badgeCount;
    return this;
  }

  /**
   * Get badgeCount
   * @return badgeCount
   */
  @javax.annotation.Nullable
  public Integer getBadgeCount() {
    return badgeCount;
  }

  public void setBadgeCount(@javax.annotation.Nullable Integer badgeCount) {
    this.badgeCount = badgeCount;
  }


  public Application downloadCount(@javax.annotation.Nullable Integer downloadCount) {
    this.downloadCount = downloadCount;
    return this;
  }

  /**
   * Get downloadCount
   * @return downloadCount
   */
  @javax.annotation.Nullable
  public Integer getDownloadCount() {
    return downloadCount;
  }

  public void setDownloadCount(@javax.annotation.Nullable Integer downloadCount) {
    this.downloadCount = downloadCount;
  }


  public Application created(@javax.annotation.Nullable OffsetDateTime created) {
    this.created = created;
    return this;
  }

  /**
   * Get created
   * @return created
   */
  @javax.annotation.Nullable
  public OffsetDateTime getCreated() {
    return created;
  }

  public void setCreated(@javax.annotation.Nullable OffsetDateTime created) {
    this.created = created;
  }


  public Application updated(@javax.annotation.Nullable OffsetDateTime updated) {
    this.updated = updated;
    return this;
  }

  /**
   * Get updated
   * @return updated
   */
  @javax.annotation.Nullable
  public OffsetDateTime getUpdated() {
    return updated;
  }

  public void setUpdated(@javax.annotation.Nullable OffsetDateTime updated) {
    this.updated = updated;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Application application = (Application) o;
    return Objects.equals(this.id, application.id) &&
        Objects.equals(this.name, application.name) &&
        Objects.equals(this.description, application.description) &&
        Objects.equals(this.type, application.type) &&
        Objects.equals(this.organizationId, application.organizationId) &&
        Objects.equals(this.iconUrl, application.iconUrl) &&
        Objects.equals(this.bannerUrl, application.bannerUrl) &&
        Objects.equals(this.capsuleImageUrl, application.capsuleImageUrl) &&
        Objects.equals(this.libraryImageUrl, application.libraryImageUrl) &&
        Objects.equals(this.parentId, application.parentId) &&
        Objects.equals(this.slug, application.slug) &&
        Objects.equals(this.visibility, application.visibility) &&
        Objects.equals(this.password, application.password) &&
        Objects.equals(this.primary, application.primary) &&
        Objects.equals(this.userCount, application.userCount) &&
        Objects.equals(this.achievementCount, application.achievementCount) &&
        Objects.equals(this.badgeCount, application.badgeCount) &&
        Objects.equals(this.downloadCount, application.downloadCount) &&
        Objects.equals(this.created, application.created) &&
        Objects.equals(this.updated, application.updated);
  }

  private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
    return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, name, description, type, organizationId, iconUrl, bannerUrl, capsuleImageUrl, libraryImageUrl, parentId, slug, visibility, password, primary, userCount, achievementCount, badgeCount, downloadCount, created, updated);
  }

  private static <T> int hashCodeNullable(JsonNullable<T> a) {
    if (a == null) {
      return 1;
    }
    return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Application {\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    organizationId: ").append(toIndentedString(organizationId)).append("\n");
    sb.append("    iconUrl: ").append(toIndentedString(iconUrl)).append("\n");
    sb.append("    bannerUrl: ").append(toIndentedString(bannerUrl)).append("\n");
    sb.append("    capsuleImageUrl: ").append(toIndentedString(capsuleImageUrl)).append("\n");
    sb.append("    libraryImageUrl: ").append(toIndentedString(libraryImageUrl)).append("\n");
    sb.append("    parentId: ").append(toIndentedString(parentId)).append("\n");
    sb.append("    slug: ").append(toIndentedString(slug)).append("\n");
    sb.append("    visibility: ").append(toIndentedString(visibility)).append("\n");
    sb.append("    password: ").append(toIndentedString(password)).append("\n");
    sb.append("    primary: ").append(toIndentedString(primary)).append("\n");
    sb.append("    userCount: ").append(toIndentedString(userCount)).append("\n");
    sb.append("    achievementCount: ").append(toIndentedString(achievementCount)).append("\n");
    sb.append("    badgeCount: ").append(toIndentedString(badgeCount)).append("\n");
    sb.append("    downloadCount: ").append(toIndentedString(downloadCount)).append("\n");
    sb.append("    created: ").append(toIndentedString(created)).append("\n");
    sb.append("    updated: ").append(toIndentedString(updated)).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    ");
  }


  public static HashSet<String> openapiFields;
  public static HashSet<String> openapiRequiredFields;

  static {
    // a set of all properties/fields (JSON key names)
    openapiFields = new HashSet<String>();
    openapiFields.add("id");
    openapiFields.add("name");
    openapiFields.add("description");
    openapiFields.add("type");
    openapiFields.add("organization_id");
    openapiFields.add("icon_url");
    openapiFields.add("banner_url");
    openapiFields.add("capsule_image_url");
    openapiFields.add("library_image_url");
    openapiFields.add("parent_id");
    openapiFields.add("slug");
    openapiFields.add("visibility");
    openapiFields.add("password");
    openapiFields.add("primary");
    openapiFields.add("user_count");
    openapiFields.add("achievement_count");
    openapiFields.add("badge_count");
    openapiFields.add("download_count");
    openapiFields.add("created");
    openapiFields.add("updated");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet<String>();
  }

  /**
   * Validates the JSON Element and throws an exception if issues found
   *
   * @param jsonElement JSON Element
   * @throws IOException if the JSON Element is invalid with respect to Application
   */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!Application.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in Application is not found in the empty JSON string", Application.openapiRequiredFields.toString()));
        }
      }

      Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
      // check to see if the JSON string contains additional fields
      for (Map.Entry<String, JsonElement> entry : entries) {
        if (!Application.openapiFields.contains(entry.getKey())) {
          throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Application` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
      if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
      }
      if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
      }
      if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
      }
      // validate the optional field `type`
      if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) {
        ApplicationType.validateJsonElement(jsonObj.get("type"));
      }
      if ((jsonObj.get("organization_id") != null && !jsonObj.get("organization_id").isJsonNull()) && !jsonObj.get("organization_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `organization_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("organization_id").toString()));
      }
      if ((jsonObj.get("icon_url") != null && !jsonObj.get("icon_url").isJsonNull()) && !jsonObj.get("icon_url").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `icon_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("icon_url").toString()));
      }
      if ((jsonObj.get("banner_url") != null && !jsonObj.get("banner_url").isJsonNull()) && !jsonObj.get("banner_url").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `banner_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("banner_url").toString()));
      }
      if ((jsonObj.get("capsule_image_url") != null && !jsonObj.get("capsule_image_url").isJsonNull()) && !jsonObj.get("capsule_image_url").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `capsule_image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("capsule_image_url").toString()));
      }
      if ((jsonObj.get("library_image_url") != null && !jsonObj.get("library_image_url").isJsonNull()) && !jsonObj.get("library_image_url").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `library_image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("library_image_url").toString()));
      }
      if ((jsonObj.get("parent_id") != null && !jsonObj.get("parent_id").isJsonNull()) && !jsonObj.get("parent_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `parent_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parent_id").toString()));
      }
      if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString()));
      }
      if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString()));
      }
  }

  public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
    @SuppressWarnings("unchecked")
    @Override
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
       if (!Application.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'Application' and its subtypes
       }
       final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter<Application> thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(Application.class));

       return (TypeAdapter<T>) new TypeAdapter<Application>() {
           @Override
           public void write(JsonWriter out, Application value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             elementAdapter.write(out, obj);
           }

           @Override
           public Application read(JsonReader in) throws IOException {
             JsonElement jsonElement = elementAdapter.read(in);
             validateJsonElement(jsonElement);
             return thisAdapter.fromJsonTree(jsonElement);
           }

       }.nullSafe();
    }
  }

  /**
   * Create an instance of Application given an JSON string
   *
   * @param jsonString JSON string
   * @return An instance of Application
   * @throws IOException if the JSON string is invalid with respect to Application
   */
  public static Application fromJson(String jsonString) throws IOException {
    return JSON.getGson().fromJson(jsonString, Application.class);
  }

  /**
   * Convert an instance of Application to an JSON string
   *
   * @return JSON string
   */
  public String toJson() {
    return JSON.getGson().toJson(this);
  }
}

