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

com.hopper.cloud.airlines.model.CreateCfarOfferRequest 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 java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

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 com.hopper.cloud.airlines.JSON;

/**
 * A create CFAR offer request
 */
@ApiModel(description = "A create CFAR offer request")
@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 CreateCfarOfferRequest {
  public static final String SERIALIZED_NAME_ITINERARY = "itinerary";
  @SerializedName(SERIALIZED_NAME_ITINERARY)
  private List itinerary = new ArrayList<>();

  public static final String SERIALIZED_NAME_REQUEST_TYPE = "request_type";
  @SerializedName(SERIALIZED_NAME_REQUEST_TYPE)
  private RequestType requestType;

  public static final String SERIALIZED_NAME_BOOKING_DATE_TIME = "booking_date_time";
  @SerializedName(SERIALIZED_NAME_BOOKING_DATE_TIME)
  private OffsetDateTime bookingDateTime;

  public static final String SERIALIZED_NAME_EXT_ATTRIBUTES = "ext_attributes";
  @SerializedName(SERIALIZED_NAME_EXT_ATTRIBUTES)
  private Map extAttributes = new HashMap<>();

  public CreateCfarOfferRequest() { 
  }

  public CreateCfarOfferRequest itinerary(List itinerary) {
    
    this.itinerary = itinerary;
    return this;
  }

  public CreateCfarOfferRequest addItineraryItem(CfarOfferItinerary itineraryItem) {
    this.itinerary.add(itineraryItem);
    return this;
  }

   /**
   * Get itinerary
   * @return itinerary
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(required = true, value = "")

  public List getItinerary() {
    return itinerary;
  }


  public void setItinerary(List itinerary) {
    this.itinerary = itinerary;
  }


  public CreateCfarOfferRequest requestType(RequestType requestType) {
    
    this.requestType = requestType;
    return this;
  }

   /**
   * Get requestType
   * @return requestType
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(required = true, value = "")

  public RequestType getRequestType() {
    return requestType;
  }


  public void setRequestType(RequestType requestType) {
    this.requestType = requestType;
  }


  public CreateCfarOfferRequest bookingDateTime(OffsetDateTime bookingDateTime) {
    
    this.bookingDateTime = bookingDateTime;
    return this;
  }

   /**
   * Get bookingDateTime
   * @return bookingDateTime
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public OffsetDateTime getBookingDateTime() {
    return bookingDateTime;
  }


  public void setBookingDateTime(OffsetDateTime bookingDateTime) {
    this.bookingDateTime = bookingDateTime;
  }


  public CreateCfarOfferRequest extAttributes(Map extAttributes) {
    
    this.extAttributes = extAttributes;
    return this;
  }

  public CreateCfarOfferRequest putExtAttributesItem(String key, String extAttributesItem) {
    this.extAttributes.put(key, extAttributesItem);
    return this;
  }

   /**
   * Get extAttributes
   * @return extAttributes
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(required = true, value = "")

  public Map getExtAttributes() {
    return extAttributes;
  }


  public void setExtAttributes(Map extAttributes) {
    this.extAttributes = extAttributes;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    CreateCfarOfferRequest createCfarOfferRequest = (CreateCfarOfferRequest) o;
    return Objects.equals(this.itinerary, createCfarOfferRequest.itinerary) &&
        Objects.equals(this.requestType, createCfarOfferRequest.requestType) &&
        Objects.equals(this.bookingDateTime, createCfarOfferRequest.bookingDateTime) &&
        Objects.equals(this.extAttributes, createCfarOfferRequest.extAttributes);
  }

  @Override
  public int hashCode() {
    return Objects.hash(itinerary, requestType, bookingDateTime, extAttributes);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class CreateCfarOfferRequest {\n");
    sb.append("    itinerary: ").append(toIndentedString(itinerary)).append("\n");
    sb.append("    requestType: ").append(toIndentedString(requestType)).append("\n");
    sb.append("    bookingDateTime: ").append(toIndentedString(bookingDateTime)).append("\n");
    sb.append("    extAttributes: ").append(toIndentedString(extAttributes)).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 (!CreateCfarOfferRequest.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'CreateCfarOfferRequest' and its subtypes
       }
       final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(CreateCfarOfferRequest.class));

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

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

       }.nullSafe();
    }
  }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy