/*
 * Lethean Blockchain API
 * OpenAPI for Lethean Blockchain
 *
 * The version of the OpenAPI document: 6.0.1
 * 
 *
 * 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.openapitools.client.model;

import java.util.Objects;
import java.util.Locale;
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 java.io.IOException;
import java.util.Arrays;

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 java.util.Locale;

import invalidPackageName.JSON;

/**
 * MaintainersInfoModel
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-10-19T15:35:02.750468+01:00[Europe/London]", comments = "Generator version: 7.16.0")
public class MaintainersInfoModel {
  public static final String SERIALIZED_NAME_VER_MAJOR = "ver_major";
  @SerializedName(SERIALIZED_NAME_VER_MAJOR)
  @javax.annotation.Nullable
  private Integer verMajor;

  public static final String SERIALIZED_NAME_VER_MINOR = "ver_minor";
  @SerializedName(SERIALIZED_NAME_VER_MINOR)
  @javax.annotation.Nullable
  private Integer verMinor;

  public static final String SERIALIZED_NAME_VER_REVISION = "ver_revision";
  @SerializedName(SERIALIZED_NAME_VER_REVISION)
  @javax.annotation.Nullable
  private Integer verRevision;

  public static final String SERIALIZED_NAME_BUILD_NO = "build_no";
  @SerializedName(SERIALIZED_NAME_BUILD_NO)
  @javax.annotation.Nullable
  private Integer buildNo;

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

  public MaintainersInfoModel() {
  }

  public MaintainersInfoModel verMajor(@javax.annotation.Nullable Integer verMajor) {
    this.verMajor = verMajor;
    return this;
  }

  /**
   * Get verMajor
   * minimum: 0
   * maximum: 255
   * @return verMajor
   */
  @javax.annotation.Nullable
  public Integer getVerMajor() {
    return verMajor;
  }

  public void setVerMajor(@javax.annotation.Nullable Integer verMajor) {
    this.verMajor = verMajor;
  }


  public MaintainersInfoModel verMinor(@javax.annotation.Nullable Integer verMinor) {
    this.verMinor = verMinor;
    return this;
  }

  /**
   * Get verMinor
   * minimum: 0
   * maximum: 255
   * @return verMinor
   */
  @javax.annotation.Nullable
  public Integer getVerMinor() {
    return verMinor;
  }

  public void setVerMinor(@javax.annotation.Nullable Integer verMinor) {
    this.verMinor = verMinor;
  }


  public MaintainersInfoModel verRevision(@javax.annotation.Nullable Integer verRevision) {
    this.verRevision = verRevision;
    return this;
  }

  /**
   * Get verRevision
   * minimum: 0
   * maximum: 255
   * @return verRevision
   */
  @javax.annotation.Nullable
  public Integer getVerRevision() {
    return verRevision;
  }

  public void setVerRevision(@javax.annotation.Nullable Integer verRevision) {
    this.verRevision = verRevision;
  }


  public MaintainersInfoModel buildNo(@javax.annotation.Nullable Integer buildNo) {
    this.buildNo = buildNo;
    return this;
  }

  /**
   * Get buildNo
   * minimum: 0
   * maximum: 4294967295
   * @return buildNo
   */
  @javax.annotation.Nullable
  public Integer getBuildNo() {
    return buildNo;
  }

  public void setBuildNo(@javax.annotation.Nullable Integer buildNo) {
    this.buildNo = buildNo;
  }


  public MaintainersInfoModel mode(@javax.annotation.Nullable Integer mode) {
    this.mode = mode;
    return this;
  }

  /**
   * Get mode
   * minimum: 0
   * maximum: 255
   * @return mode
   */
  @javax.annotation.Nullable
  public Integer getMode() {
    return mode;
  }

  public void setMode(@javax.annotation.Nullable Integer mode) {
    this.mode = mode;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    MaintainersInfoModel maintainersInfoModel = (MaintainersInfoModel) o;
    return Objects.equals(this.verMajor, maintainersInfoModel.verMajor) &&
        Objects.equals(this.verMinor, maintainersInfoModel.verMinor) &&
        Objects.equals(this.verRevision, maintainersInfoModel.verRevision) &&
        Objects.equals(this.buildNo, maintainersInfoModel.buildNo) &&
        Objects.equals(this.mode, maintainersInfoModel.mode);
  }

  @Override
  public int hashCode() {
    return Objects.hash(verMajor, verMinor, verRevision, buildNo, mode);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class MaintainersInfoModel {\n");
    sb.append("    verMajor: ").append(toIndentedString(verMajor)).append("\n");
    sb.append("    verMinor: ").append(toIndentedString(verMinor)).append("\n");
    sb.append("    verRevision: ").append(toIndentedString(verRevision)).append("\n");
    sb.append("    buildNo: ").append(toIndentedString(buildNo)).append("\n");
    sb.append("    mode: ").append(toIndentedString(mode)).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>(Arrays.asList("ver_major", "ver_minor", "ver_revision", "build_no", "mode"));

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

  /**
   * 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 MaintainersInfoModel
   */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!MaintainersInfoModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in MaintainersInfoModel is not found in the empty JSON string", MaintainersInfoModel.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 (!MaintainersInfoModel.openapiFields.contains(entry.getKey())) {
          throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` in the JSON string is not defined in the `MaintainersInfoModel` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
  }

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

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

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

       }.nullSafe();
    }
  }

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

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

