java/src/main/java/com/konfigthis/dojah/client/model/GetBasicPhoneNumberResponseEntity.java
/*
 * DOJAH APIs
 * Use Dojah to verify, onboard and manage user identity across Africa!
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by Konfig (https://konfigthis.com).
 * Do not edit the class manually.
 */


package com.konfigthis.dojah.client.model;

import java.util.Objects;
import java.util.Arrays;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;

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 org.apache.commons.lang3.StringUtils;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import com.konfigthis.dojah.client.JSON;

/**
 * GetBasicPhoneNumberResponseEntity
 */
@javax.annotation.Generated(value = "Generated by https://konfigthis.com")
public class GetBasicPhoneNumberResponseEntity {
  public static final String SERIALIZED_NAME_MSISDN = "msisdn";
  @SerializedName(SERIALIZED_NAME_MSISDN)
  private String msisdn;

  public static final String SERIALIZED_NAME_FIRST_NAME = "firstName";
  @SerializedName(SERIALIZED_NAME_FIRST_NAME)
  private String firstName;

  public static final String SERIALIZED_NAME_LAST_NAME = "lastName";
  @SerializedName(SERIALIZED_NAME_LAST_NAME)
  private String lastName;

  public static final String SERIALIZED_NAME_EMAIL = "email";
  @SerializedName(SERIALIZED_NAME_EMAIL)
  private String email;

  public static final String SERIALIZED_NAME_ENCRYPTED_PAN = "encryptedPan";
  @SerializedName(SERIALIZED_NAME_ENCRYPTED_PAN)
  private String encryptedPan;

  public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "dateOfBirth";
  @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH)
  private String dateOfBirth;

  public static final String SERIALIZED_NAME_BVN = "bvn";
  @SerializedName(SERIALIZED_NAME_BVN)
  private String bvn;

  public static final String SERIALIZED_NAME_ADDRESS = "address";
  @SerializedName(SERIALIZED_NAME_ADDRESS)
  private String address;

  public static final String SERIALIZED_NAME_ADDRESS_CITY = "address_city";
  @SerializedName(SERIALIZED_NAME_ADDRESS_CITY)
  private String addressCity;

  public static final String SERIALIZED_NAME_ADDRESS_STATE = "address_state";
  @SerializedName(SERIALIZED_NAME_ADDRESS_STATE)
  private String addressState;

  public static final String SERIALIZED_NAME_ACCOUNT_NUMBER = "account_number";
  @SerializedName(SERIALIZED_NAME_ACCOUNT_NUMBER)
  private String accountNumber;

  public static final String SERIALIZED_NAME_BANK_CODE = "bank_code";
  @SerializedName(SERIALIZED_NAME_BANK_CODE)
  private String bankCode;

  public static final String SERIALIZED_NAME_GENDER = "gender";
  @SerializedName(SERIALIZED_NAME_GENDER)
  private String gender;

  public GetBasicPhoneNumberResponseEntity() {
  }

  public GetBasicPhoneNumberResponseEntity msisdn(String msisdn) {

    
    
    
    
    this.msisdn = msisdn;
    return this;
  }

   /**
   * Get msisdn
   * @return msisdn
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2348103100000", value = "")

  public String getMsisdn() {
    return msisdn;
  }


  public void setMsisdn(String msisdn) {

    
    
    
    this.msisdn = msisdn;
  }


  public GetBasicPhoneNumberResponseEntity firstName(String firstName) {

    
    
    
    
    this.firstName = firstName;
    return this;
  }

   /**
   * Get firstName
   * @return firstName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "John", value = "")

  public String getFirstName() {
    return firstName;
  }


  public void setFirstName(String firstName) {

    
    
    
    this.firstName = firstName;
  }


  public GetBasicPhoneNumberResponseEntity lastName(String lastName) {

    
    
    
    
    this.lastName = lastName;
    return this;
  }

   /**
   * Get lastName
   * @return lastName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "Doe", value = "")

  public String getLastName() {
    return lastName;
  }


  public void setLastName(String lastName) {

    
    
    
    this.lastName = lastName;
  }


  public GetBasicPhoneNumberResponseEntity email(String email) {

    
    
    
    
    this.email = email;
    return this;
  }

   /**
   * Get email
   * @return email
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "ychag@example.com", value = "")

  public String getEmail() {
    return email;
  }


  public void setEmail(String email) {

    
    
    
    this.email = email;
  }


  public GetBasicPhoneNumberResponseEntity encryptedPan(String encryptedPan) {

    
    
    
    
    this.encryptedPan = encryptedPan;
    return this;
  }

   /**
   * Get encryptedPan
   * @return encryptedPan
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "1235246646GVDG", value = "")

  public String getEncryptedPan() {
    return encryptedPan;
  }


  public void setEncryptedPan(String encryptedPan) {

    
    
    
    this.encryptedPan = encryptedPan;
  }


  public GetBasicPhoneNumberResponseEntity dateOfBirth(String dateOfBirth) {

    
    
    
    
    this.dateOfBirth = dateOfBirth;
    return this;
  }

   /**
   * Get dateOfBirth
   * @return dateOfBirth
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "18/08/1997", value = "")

  public String getDateOfBirth() {
    return dateOfBirth;
  }


  public void setDateOfBirth(String dateOfBirth) {

    
    
    
    this.dateOfBirth = dateOfBirth;
  }


  public GetBasicPhoneNumberResponseEntity bvn(String bvn) {

    
    
    
    
    this.bvn = bvn;
    return this;
  }

   /**
   * Get bvn
   * @return bvn
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2222222222", value = "")

  public String getBvn() {
    return bvn;
  }


  public void setBvn(String bvn) {

    
    
    
    this.bvn = bvn;
  }


  public GetBasicPhoneNumberResponseEntity address(String address) {

    
    
    
    
    this.address = address;
    return this;
  }

   /**
   * Get address
   * @return address
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = " 25 Okota", value = "")

  public String getAddress() {
    return address;
  }


  public void setAddress(String address) {

    
    
    
    this.address = address;
  }


  public GetBasicPhoneNumberResponseEntity addressCity(String addressCity) {

    
    
    
    
    this.addressCity = addressCity;
    return this;
  }

   /**
   * Get addressCity
   * @return addressCity
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "Shomolu", value = "")

  public String getAddressCity() {
    return addressCity;
  }


  public void setAddressCity(String addressCity) {

    
    
    
    this.addressCity = addressCity;
  }


  public GetBasicPhoneNumberResponseEntity addressState(String addressState) {

    
    
    
    
    this.addressState = addressState;
    return this;
  }

   /**
   * Get addressState
   * @return addressState
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "Lagos", value = "")

  public String getAddressState() {
    return addressState;
  }


  public void setAddressState(String addressState) {

    
    
    
    this.addressState = addressState;
  }


  public GetBasicPhoneNumberResponseEntity accountNumber(String accountNumber) {

    
    
    
    
    this.accountNumber = accountNumber;
    return this;
  }

   /**
   * Get accountNumber
   * @return accountNumber
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "1234567897", value = "")

  public String getAccountNumber() {
    return accountNumber;
  }


  public void setAccountNumber(String accountNumber) {

    
    
    
    this.accountNumber = accountNumber;
  }


  public GetBasicPhoneNumberResponseEntity bankCode(String bankCode) {

    
    
    
    
    this.bankCode = bankCode;
    return this;
  }

   /**
   * Get bankCode
   * @return bankCode
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "054", value = "")

  public String getBankCode() {
    return bankCode;
  }


  public void setBankCode(String bankCode) {

    
    
    
    this.bankCode = bankCode;
  }


  public GetBasicPhoneNumberResponseEntity gender(String gender) {

    
    
    
    
    this.gender = gender;
    return this;
  }

   /**
   * Get gender
   * @return gender
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "Male", value = "")

  public String getGender() {
    return gender;
  }


  public void setGender(String gender) {

    
    
    
    this.gender = gender;
  }

  /**
   * A container for additional, undeclared properties.
   * This is a holder for any undeclared properties as specified with
   * the 'additionalProperties' keyword in the OAS document.
   */
  private Map<String, Object> additionalProperties;

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   *
   * @param key name of the property
   * @param value value of the property
   * @return the GetBasicPhoneNumberResponseEntity instance itself
   */
  public GetBasicPhoneNumberResponseEntity putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Object>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Return the additional (undeclared) property.
   *
   * @return a map of objects
   */
  public Map<String, Object> getAdditionalProperties() {
    return additionalProperties;
  }

  /**
   * Return the additional (undeclared) property with the specified name.
   *
   * @param key name of the property
   * @return an object
   */
  public Object getAdditionalProperty(String key) {
    if (this.additionalProperties == null) {
        return null;
    }
    return this.additionalProperties.get(key);
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    GetBasicPhoneNumberResponseEntity getBasicPhoneNumberResponseEntity = (GetBasicPhoneNumberResponseEntity) o;
    return Objects.equals(this.msisdn, getBasicPhoneNumberResponseEntity.msisdn) &&
        Objects.equals(this.firstName, getBasicPhoneNumberResponseEntity.firstName) &&
        Objects.equals(this.lastName, getBasicPhoneNumberResponseEntity.lastName) &&
        Objects.equals(this.email, getBasicPhoneNumberResponseEntity.email) &&
        Objects.equals(this.encryptedPan, getBasicPhoneNumberResponseEntity.encryptedPan) &&
        Objects.equals(this.dateOfBirth, getBasicPhoneNumberResponseEntity.dateOfBirth) &&
        Objects.equals(this.bvn, getBasicPhoneNumberResponseEntity.bvn) &&
        Objects.equals(this.address, getBasicPhoneNumberResponseEntity.address) &&
        Objects.equals(this.addressCity, getBasicPhoneNumberResponseEntity.addressCity) &&
        Objects.equals(this.addressState, getBasicPhoneNumberResponseEntity.addressState) &&
        Objects.equals(this.accountNumber, getBasicPhoneNumberResponseEntity.accountNumber) &&
        Objects.equals(this.bankCode, getBasicPhoneNumberResponseEntity.bankCode) &&
        Objects.equals(this.gender, getBasicPhoneNumberResponseEntity.gender)&&
        Objects.equals(this.additionalProperties, getBasicPhoneNumberResponseEntity.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(msisdn, firstName, lastName, email, encryptedPan, dateOfBirth, bvn, address, addressCity, addressState, accountNumber, bankCode, gender, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class GetBasicPhoneNumberResponseEntity {\n");
    sb.append("    msisdn: ").append(toIndentedString(msisdn)).append("\n");
    sb.append("    firstName: ").append(toIndentedString(firstName)).append("\n");
    sb.append("    lastName: ").append(toIndentedString(lastName)).append("\n");
    sb.append("    email: ").append(toIndentedString(email)).append("\n");
    sb.append("    encryptedPan: ").append(toIndentedString(encryptedPan)).append("\n");
    sb.append("    dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n");
    sb.append("    bvn: ").append(toIndentedString(bvn)).append("\n");
    sb.append("    address: ").append(toIndentedString(address)).append("\n");
    sb.append("    addressCity: ").append(toIndentedString(addressCity)).append("\n");
    sb.append("    addressState: ").append(toIndentedString(addressState)).append("\n");
    sb.append("    accountNumber: ").append(toIndentedString(accountNumber)).append("\n");
    sb.append("    bankCode: ").append(toIndentedString(bankCode)).append("\n");
    sb.append("    gender: ").append(toIndentedString(gender)).append("\n");
    sb.append("    additionalProperties: ").append(toIndentedString(additionalProperties)).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("msisdn");
    openapiFields.add("firstName");
    openapiFields.add("lastName");
    openapiFields.add("email");
    openapiFields.add("encryptedPan");
    openapiFields.add("dateOfBirth");
    openapiFields.add("bvn");
    openapiFields.add("address");
    openapiFields.add("address_city");
    openapiFields.add("address_state");
    openapiFields.add("account_number");
    openapiFields.add("bank_code");
    openapiFields.add("gender");

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

 /**
  * Validates the JSON Object and throws an exception if issues found
  *
  * @param jsonObj JSON Object
  * @throws IOException if the JSON Object is invalid with respect to GetBasicPhoneNumberResponseEntity
  */
  public static void validateJsonObject(JsonObject jsonObj) throws IOException {
      if (jsonObj == null) {
        if (!GetBasicPhoneNumberResponseEntity.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in GetBasicPhoneNumberResponseEntity is not found in the empty JSON string", GetBasicPhoneNumberResponseEntity.openapiRequiredFields.toString()));
        }
      }
      if ((jsonObj.get("msisdn") != null && !jsonObj.get("msisdn").isJsonNull()) && !jsonObj.get("msisdn").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `msisdn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("msisdn").toString()));
      }
      if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString()));
      }
      if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString()));
      }
      if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString()));
      }
      if ((jsonObj.get("encryptedPan") != null && !jsonObj.get("encryptedPan").isJsonNull()) && !jsonObj.get("encryptedPan").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `encryptedPan` to be a primitive type in the JSON string but got `%s`", jsonObj.get("encryptedPan").toString()));
      }
      if ((jsonObj.get("dateOfBirth") != null && !jsonObj.get("dateOfBirth").isJsonNull()) && !jsonObj.get("dateOfBirth").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `dateOfBirth` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dateOfBirth").toString()));
      }
      if ((jsonObj.get("bvn") != null && !jsonObj.get("bvn").isJsonNull()) && !jsonObj.get("bvn").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `bvn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bvn").toString()));
      }
      if ((jsonObj.get("address") != null && !jsonObj.get("address").isJsonNull()) && !jsonObj.get("address").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `address` to be a primitive type in the JSON string but got `%s`", jsonObj.get("address").toString()));
      }
      if ((jsonObj.get("address_city") != null && !jsonObj.get("address_city").isJsonNull()) && !jsonObj.get("address_city").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `address_city` to be a primitive type in the JSON string but got `%s`", jsonObj.get("address_city").toString()));
      }
      if ((jsonObj.get("address_state") != null && !jsonObj.get("address_state").isJsonNull()) && !jsonObj.get("address_state").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `address_state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("address_state").toString()));
      }
      if ((jsonObj.get("account_number") != null && !jsonObj.get("account_number").isJsonNull()) && !jsonObj.get("account_number").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `account_number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("account_number").toString()));
      }
      if ((jsonObj.get("bank_code") != null && !jsonObj.get("bank_code").isJsonNull()) && !jsonObj.get("bank_code").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `bank_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bank_code").toString()));
      }
      if ((jsonObj.get("gender") != null && !jsonObj.get("gender").isJsonNull()) && !jsonObj.get("gender").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `gender` to be a primitive type in the JSON string but got `%s`", jsonObj.get("gender").toString()));
      }
  }

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

       return (TypeAdapter<T>) new TypeAdapter<GetBasicPhoneNumberResponseEntity>() {
           @Override
           public void write(JsonWriter out, GetBasicPhoneNumberResponseEntity value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             obj.remove("additionalProperties");
             // serialize additonal properties
             if (value.getAdditionalProperties() != null) {
               for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
                 if (entry.getValue() instanceof String)
                   obj.addProperty(entry.getKey(), (String) entry.getValue());
                 else if (entry.getValue() instanceof Number)
                   obj.addProperty(entry.getKey(), (Number) entry.getValue());
                 else if (entry.getValue() instanceof Boolean)
                   obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
                 else if (entry.getValue() instanceof Character)
                   obj.addProperty(entry.getKey(), (Character) entry.getValue());
                 else {
                   obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
                 }
               }
             }
             elementAdapter.write(out, obj);
           }

           @Override
           public GetBasicPhoneNumberResponseEntity read(JsonReader in) throws IOException {
             JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
             validateJsonObject(jsonObj);
             // store additional fields in the deserialized instance
             GetBasicPhoneNumberResponseEntity instance = thisAdapter.fromJsonTree(jsonObj);
             for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
               if (!openapiFields.contains(entry.getKey())) {
                 if (entry.getValue().isJsonPrimitive()) { // primitive type
                   if (entry.getValue().getAsJsonPrimitive().isString())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
                   else if (entry.getValue().getAsJsonPrimitive().isNumber())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
                   else if (entry.getValue().getAsJsonPrimitive().isBoolean())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
                   else
                     throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
                 } else if (entry.getValue().isJsonArray()) {
                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
                 } else { // JSON object
                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
                 }
               }
             }
             return instance;
           }

       }.nullSafe();
    }
  }

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

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

