All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hopper.cloud.airlines.model.UserInfo Maven / Gradle / Ivy

The newest version!
/*
 * Airline API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1.0
 * 
 *
 * 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.hopper.cloud.airlines.model;

import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.gson.TypeAdapter;
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 java.time.OffsetDateTime;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;

import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;

import com.hopper.cloud.airlines.JSON;

/**
 * Informations related to the airline's user. Should be included if known, but not if the user is anonymous
 */
@ApiModel(description = "Informations related to the airline's user. Should be included if known, but not if the user is anonymous")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-06-28T12:18:49.517876+02:00[Europe/Paris]")
@JsonInclude(JsonInclude.Include. NON_NULL)
public class UserInfo {
  public static final String SERIALIZED_NAME_AIRLINE_USER_ID = "airline_user_id";
  @SerializedName(SERIALIZED_NAME_AIRLINE_USER_ID)
  private String airlineUserId;

  public static final String SERIALIZED_NAME_CREATED_DATE_TIME = "created_date_time";
  @SerializedName(SERIALIZED_NAME_CREATED_DATE_TIME)
  private OffsetDateTime createdDateTime;

  public static final String SERIALIZED_NAME_PREVIOUS_BOOKINGS = "previous_bookings";
  @SerializedName(SERIALIZED_NAME_PREVIOUS_BOOKINGS)
  private Integer previousBookings;

  public UserInfo() { 
  }

  public UserInfo airlineUserId(String airlineUserId) {
    
    this.airlineUserId = airlineUserId;
    return this;
  }

   /**
   * The airline's unique identifier for a user; can be an arbitrary string
   * @return airlineUserId
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "2bcd6619-ac3e-403b-9982-3e12f2698a53", required = true, value = "The airline's unique identifier for a user; can be an arbitrary string")

  public String getAirlineUserId() {
    return airlineUserId;
  }


  public void setAirlineUserId(String airlineUserId) {
    this.airlineUserId = airlineUserId;
  }


  public UserInfo createdDateTime(OffsetDateTime createdDateTime) {
    
    this.createdDateTime = createdDateTime;
    return this;
  }

   /**
   * A UTC [RFC3339](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) datetime; the date and time at which a user's account was created
   * @return createdDateTime
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2020-11-02T18:34:30Z", value = "A UTC [RFC3339](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) datetime; the date and time at which a user's account was created")

  public OffsetDateTime getCreatedDateTime() {
    return createdDateTime;
  }


  public void setCreatedDateTime(OffsetDateTime createdDateTime) {
    this.createdDateTime = createdDateTime;
  }


  public UserInfo previousBookings(Integer previousBookings) {
    
    this.previousBookings = previousBookings;
    return this;
  }

   /**
   * Number of prior bookings a user has made
   * minimum: 0
   * @return previousBookings
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "3", value = "Number of prior bookings a user has made")

  public Integer getPreviousBookings() {
    return previousBookings;
  }


  public void setPreviousBookings(Integer previousBookings) {
    this.previousBookings = previousBookings;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    UserInfo userInfo = (UserInfo) o;
    return Objects.equals(this.airlineUserId, userInfo.airlineUserId) &&
        Objects.equals(this.createdDateTime, userInfo.createdDateTime) &&
        Objects.equals(this.previousBookings, userInfo.previousBookings);
  }

  @Override
  public int hashCode() {
    return Objects.hash(airlineUserId, createdDateTime, previousBookings);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class UserInfo {\n");
    sb.append("    airlineUserId: ").append(toIndentedString(airlineUserId)).append("\n");
    sb.append("    createdDateTime: ").append(toIndentedString(createdDateTime)).append("\n");
    sb.append("    previousBookings: ").append(toIndentedString(previousBookings)).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 class CustomTypeAdapterFactory implements TypeAdapterFactory {
    @SuppressWarnings("unchecked")
    @Override
    public  TypeAdapter create(Gson gson, TypeToken type) {
       if (!UserInfo.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'UserInfo' and its subtypes
       }
       final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(UserInfo.class));

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

           @Override
           public UserInfo read(JsonReader in) throws IOException {
             JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
             return thisAdapter.fromJsonTree(jsonObj);
           }

       }.nullSafe();
    }
  }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy