TribufuJava/src/main/java/com/tribufu/generated/models/ProfileGroup.java

479 lines
14 KiB
Java

/*
* Tribufu API
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.4.3
* 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.GroupRank;
import java.io.IOException;
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;
/**
* ProfileGroup
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:18:39.326231700-03:00[America/Sao_Paulo]", comments = "Generator version: 7.12.0")
public class ProfileGroup {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
@javax.annotation.Nullable
private String id;
public static final String SERIALIZED_NAME_UUID = "uuid";
@SerializedName(SERIALIZED_NAME_UUID)
@javax.annotation.Nullable
private String uuid;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
@javax.annotation.Nullable
private String name;
public static final String SERIALIZED_NAME_TAG = "tag";
@SerializedName(SERIALIZED_NAME_TAG)
@javax.annotation.Nullable
private String tag;
public static final String SERIALIZED_NAME_PRIVACY = "privacy";
@SerializedName(SERIALIZED_NAME_PRIVACY)
@javax.annotation.Nullable
private Integer privacy;
public static final String SERIALIZED_NAME_VERIFIED = "verified";
@SerializedName(SERIALIZED_NAME_VERIFIED)
@javax.annotation.Nullable
private Boolean verified;
public static final String SERIALIZED_NAME_PHOTO_URL = "photo_url";
@SerializedName(SERIALIZED_NAME_PHOTO_URL)
@javax.annotation.Nullable
private String photoUrl;
public static final String SERIALIZED_NAME_MEMBER_COUNT = "member_count";
@SerializedName(SERIALIZED_NAME_MEMBER_COUNT)
@javax.annotation.Nullable
private Integer memberCount;
public static final String SERIALIZED_NAME_RANK = "rank";
@SerializedName(SERIALIZED_NAME_RANK)
@javax.annotation.Nullable
private GroupRank rank;
public static final String SERIALIZED_NAME_SINCE = "since";
@SerializedName(SERIALIZED_NAME_SINCE)
@javax.annotation.Nullable
private OffsetDateTime since;
public ProfileGroup() {
}
public ProfileGroup 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 ProfileGroup uuid(@javax.annotation.Nullable String uuid) {
this.uuid = uuid;
return this;
}
/**
* Get uuid
* @return uuid
*/
@javax.annotation.Nullable
public String getUuid() {
return uuid;
}
public void setUuid(@javax.annotation.Nullable String uuid) {
this.uuid = uuid;
}
public ProfileGroup 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 ProfileGroup tag(@javax.annotation.Nullable String tag) {
this.tag = tag;
return this;
}
/**
* Get tag
* @return tag
*/
@javax.annotation.Nullable
public String getTag() {
return tag;
}
public void setTag(@javax.annotation.Nullable String tag) {
this.tag = tag;
}
public ProfileGroup privacy(@javax.annotation.Nullable Integer privacy) {
this.privacy = privacy;
return this;
}
/**
* Get privacy
* @return privacy
*/
@javax.annotation.Nullable
public Integer getPrivacy() {
return privacy;
}
public void setPrivacy(@javax.annotation.Nullable Integer privacy) {
this.privacy = privacy;
}
public ProfileGroup verified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
return this;
}
/**
* Get verified
* @return verified
*/
@javax.annotation.Nullable
public Boolean getVerified() {
return verified;
}
public void setVerified(@javax.annotation.Nullable Boolean verified) {
this.verified = verified;
}
public ProfileGroup photoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
return this;
}
/**
* Get photoUrl
* @return photoUrl
*/
@javax.annotation.Nullable
public String getPhotoUrl() {
return photoUrl;
}
public void setPhotoUrl(@javax.annotation.Nullable String photoUrl) {
this.photoUrl = photoUrl;
}
public ProfileGroup memberCount(@javax.annotation.Nullable Integer memberCount) {
this.memberCount = memberCount;
return this;
}
/**
* Get memberCount
* @return memberCount
*/
@javax.annotation.Nullable
public Integer getMemberCount() {
return memberCount;
}
public void setMemberCount(@javax.annotation.Nullable Integer memberCount) {
this.memberCount = memberCount;
}
public ProfileGroup rank(@javax.annotation.Nullable GroupRank rank) {
this.rank = rank;
return this;
}
/**
* Get rank
* @return rank
*/
@javax.annotation.Nullable
public GroupRank getRank() {
return rank;
}
public void setRank(@javax.annotation.Nullable GroupRank rank) {
this.rank = rank;
}
public ProfileGroup since(@javax.annotation.Nullable OffsetDateTime since) {
this.since = since;
return this;
}
/**
* Get since
* @return since
*/
@javax.annotation.Nullable
public OffsetDateTime getSince() {
return since;
}
public void setSince(@javax.annotation.Nullable OffsetDateTime since) {
this.since = since;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ProfileGroup profileGroup = (ProfileGroup) o;
return Objects.equals(this.id, profileGroup.id) &&
Objects.equals(this.uuid, profileGroup.uuid) &&
Objects.equals(this.name, profileGroup.name) &&
Objects.equals(this.tag, profileGroup.tag) &&
Objects.equals(this.privacy, profileGroup.privacy) &&
Objects.equals(this.verified, profileGroup.verified) &&
Objects.equals(this.photoUrl, profileGroup.photoUrl) &&
Objects.equals(this.memberCount, profileGroup.memberCount) &&
Objects.equals(this.rank, profileGroup.rank) &&
Objects.equals(this.since, profileGroup.since);
}
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, uuid, name, tag, privacy, verified, photoUrl, memberCount, rank, since);
}
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 ProfileGroup {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" tag: ").append(toIndentedString(tag)).append("\n");
sb.append(" privacy: ").append(toIndentedString(privacy)).append("\n");
sb.append(" verified: ").append(toIndentedString(verified)).append("\n");
sb.append(" photoUrl: ").append(toIndentedString(photoUrl)).append("\n");
sb.append(" memberCount: ").append(toIndentedString(memberCount)).append("\n");
sb.append(" rank: ").append(toIndentedString(rank)).append("\n");
sb.append(" since: ").append(toIndentedString(since)).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("uuid");
openapiFields.add("name");
openapiFields.add("tag");
openapiFields.add("privacy");
openapiFields.add("verified");
openapiFields.add("photo_url");
openapiFields.add("member_count");
openapiFields.add("rank");
openapiFields.add("since");
// 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 ProfileGroup
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ProfileGroup.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in ProfileGroup is not found in the empty JSON string", ProfileGroup.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 (!ProfileGroup.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ProfileGroup` 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("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").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("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString()));
}
if ((jsonObj.get("photo_url") != null && !jsonObj.get("photo_url").isJsonNull()) && !jsonObj.get("photo_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `photo_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("photo_url").toString()));
}
// validate the optional field `rank`
if (jsonObj.get("rank") != null && !jsonObj.get("rank").isJsonNull()) {
GroupRank.validateJsonElement(jsonObj.get("rank"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!ProfileGroup.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ProfileGroup' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<ProfileGroup> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ProfileGroup.class));
return (TypeAdapter<T>) new TypeAdapter<ProfileGroup>() {
@Override
public void write(JsonWriter out, ProfileGroup value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public ProfileGroup read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of ProfileGroup given an JSON string
*
* @param jsonString JSON string
* @return An instance of ProfileGroup
* @throws IOException if the JSON string is invalid with respect to ProfileGroup
*/
public static ProfileGroup fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ProfileGroup.class);
}
/**
* Convert an instance of ProfileGroup to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}