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

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

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;

/**
 * An object detailing a CFAR itinerary used for offers creation
 */
@ApiModel(description = "An object detailing a CFAR itinerary used for offers creation")
@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 CfarOfferItinerary {
    public static final String SERIALIZED_NAME_PASSENGER_PRICING = "passenger_pricing";
    @SerializedName(SERIALIZED_NAME_PASSENGER_PRICING)
    private List passengerPricing = new ArrayList<>();

    public static final String SERIALIZED_NAME_CURRENCY = "currency";
    @SerializedName(SERIALIZED_NAME_CURRENCY)
    private String currency;

    public static final String SERIALIZED_NAME_SLICES = "slices";
    @SerializedName(SERIALIZED_NAME_SLICES)
    private List slices = new ArrayList<>();

    public static final String SERIALIZED_NAME_ANCILLARIES = "ancillaries";
    @SerializedName(SERIALIZED_NAME_ANCILLARIES)
    private List ancillaries = null;

    public static final String SERIALIZED_NAME_TOTAL_PRICE = "total_price";
    @SerializedName(SERIALIZED_NAME_TOTAL_PRICE)
    private String totalPrice;

    public static final String SERIALIZED_NAME_PASSENGERS = "passengers";
    @SerializedName(SERIALIZED_NAME_PASSENGERS)
    private List passengers = null;

    public static final String SERIALIZED_NAME_FARE_RULES = "fare_rules";
    @SerializedName(SERIALIZED_NAME_FARE_RULES)
    private List fareRules = null;

    public CfarOfferItinerary() {
    }

    public CfarOfferItinerary passengerPricing(List passengerPricing) {

        this.passengerPricing = passengerPricing;
        return this;
    }

    public CfarOfferItinerary addPassengerPricingItem(PassengerPricing passengerPricingItem) {
        this.passengerPricing.add(passengerPricingItem);
        return this;
    }

    /**
     * List of pricing per passenger for a fare
     * @return passengerPricing
     **/
    @javax.annotation.Nonnull
    @ApiModelProperty(required = true, value = "List of pricing per passenger for a fare")

    public List getPassengerPricing() {
        return passengerPricing;
    }


    public void setPassengerPricing(List passengerPricing) {
        this.passengerPricing = passengerPricing;
    }


    public CfarOfferItinerary currency(String currency) {

        this.currency = currency;
        return this;
    }

    /**
     * Currency of pricing fields
     * @return currency
     **/
    @javax.annotation.Nonnull
    @ApiModelProperty(example = "CAD", required = true, value = "Currency of pricing fields")

    public String getCurrency() {
        return currency;
    }


    public void setCurrency(String currency) {
        this.currency = currency;
    }


    public CfarOfferItinerary slices(List slices) {

        this.slices = slices;
        return this;
    }

    public CfarOfferItinerary addSlicesItem(CfarItinerarySlice slicesItem) {
        this.slices.add(slicesItem);
        return this;
    }

    /**
     * List of fare slices included in this fare; only 1 (one way) or 2 (round trip) slices are allowed
     * @return slices
     **/
    @javax.annotation.Nonnull
    @ApiModelProperty(required = true, value = "List of fare slices included in this fare; only 1 (one way) or 2 (round trip) slices are allowed")

    public List getSlices() {
        return slices;
    }


    public void setSlices(List slices) {
        this.slices = slices;
    }


    public CfarOfferItinerary ancillaries(List ancillaries) {

        this.ancillaries = ancillaries;
        return this;
    }

    public CfarOfferItinerary addAncillariesItem(Ancillary ancillariesItem) {
        if (this.ancillaries == null) {
            this.ancillaries = new ArrayList<>();
        }
        this.ancillaries.add(ancillariesItem);
        return this;
    }

    /**
     * Ancillaries attached to a fare and their prices
     * @return ancillaries
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Ancillaries attached to a fare and their prices")

    public List getAncillaries() {
        return ancillaries;
    }

    public void setAncillaries(List ancillaries) {
        this.ancillaries = ancillaries;
    }


    public CfarOfferItinerary totalPrice(String totalPrice) {

        this.totalPrice = totalPrice;
        return this;
    }

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

    public String getTotalPrice() {
        return totalPrice;
    }


    public void setTotalPrice(String totalPrice) {
        this.totalPrice = totalPrice;
    }

    public CfarOfferItinerary passengers(List passengers) {
        this.passengers = passengers;
        return this;
    }

    public CfarOfferItinerary addPassengersItem(CfarOfferPassenger passengerItem) {
        if (this.passengers == null) {
            this.passengers = new ArrayList<>();
        }
        this.passengers.add(passengerItem);
        return this;
    }

    /**
     * Retrieve Passengers
     * @return passengers
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "Passengers associated with the itinerary")

    public List getPassengers() {
        return passengers;
    }

    public void setPassengers(List passengers) {
        this.passengers = passengers;
    }

    public CfarOfferItinerary fareRules(List fareRules) {
        this.fareRules = fareRules;
        return this;
    }

    public CfarOfferItinerary addFareRulesItem(FareRule fareRuleItem) {
        if (this.fareRules == null) {
            this.fareRules = new ArrayList<>();
        }
        this.fareRules.add(fareRuleItem);
        return this;
    }

    /**
     * Retrieve fare rules associated to the itinerary
     * @return fareRules
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(value = "The fare rules associated to the itinerary. If different fare rules apply to different slices in the itinerary, indicate the most restrictive")

    public List getFareRules() {
        return fareRules;
    }

    public void setFareRules(List fareRules) {
        this.fareRules = fareRules;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CfarOfferItinerary cfarItinerary = (CfarOfferItinerary) o;
        return Objects.equals(this.passengerPricing, cfarItinerary.passengerPricing) &&
                Objects.equals(this.currency, cfarItinerary.currency) &&
                Objects.equals(this.slices, cfarItinerary.slices) &&
                Objects.equals(this.ancillaries, cfarItinerary.ancillaries) &&
                Objects.equals(this.passengers, cfarItinerary.passengers) &&
                Objects.equals(this.fareRules, cfarItinerary.fareRules);
    }

    @Override
    public int hashCode() {
        return Objects.hash(passengerPricing, currency, slices, ancillaries, totalPrice, passengers, fareRules);
    }

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

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

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

            }.nullSafe();
        }
    }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy