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

com.hopper.cloud.airlines.model.PassengerPricing 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.*;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.gson.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.hopper.cloud.airlines.model.PassengerCount;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;

import com.google.gson.reflect.TypeToken;

import java.util.Map.Entry;

import com.hopper.cloud.airlines.JSON;

/**
 * PassengerPricing
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-07-04T17:36:41.937885+02:00[Europe/Paris]")
@JsonInclude(JsonInclude.Include. NON_NULL)
public class PassengerPricing {
    public static final String SERIALIZED_NAME_PASSENGER_COUNT = "passenger_count";
    @SerializedName(SERIALIZED_NAME_PASSENGER_COUNT)
    private PassengerCount passengerCount;

    public static final String SERIALIZED_NAME_INDIVIDUAL_PRICE = "individual_price";
    @SerializedName(SERIALIZED_NAME_INDIVIDUAL_PRICE)
    private String individualPrice;

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

    public PassengerPricing() {
    }

    public PassengerPricing passengerCount(PassengerCount passengerCount) {

        this.passengerCount = passengerCount;
        return this;
    }

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

    public PassengerCount getPassengerCount() {
        return passengerCount;
    }


    public void setPassengerCount(PassengerCount passengerCount) {
        this.passengerCount = passengerCount;
    }


    public PassengerPricing individualPrice(String individualPrice) {

        this.individualPrice = individualPrice;
        return this;
    }

    /**
     * Price per passenger
     * @return individualPrice
     **/
    @javax.annotation.Nullable
    @ApiModelProperty(example = "20.55", value = "Price per passenger")

    public String getIndividualPrice() {
        return individualPrice;
    }


    public void setIndividualPrice(String individualPrice) {
        this.individualPrice = individualPrice;
    }

    public PassengerPricing taxes(List taxes) {

        this.taxes = taxes;
        return this;
    }

    public PassengerPricing addCfarTaxItem(CfarPassengerTax cfarTaxItem) {
        if (this.taxes != null) {
            this.taxes.add(cfarTaxItem);
        }
        return this;
    }

    public List getTaxes() {
        return taxes;
    }
    public void setTaxes(List taxes) {
        this.taxes = taxes;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PassengerPricing passengerPricing = (PassengerPricing) o;
        return Objects.equals(this.passengerCount, passengerPricing.passengerCount) &&
                Objects.equals(this.individualPrice, passengerPricing.individualPrice) &&
                Objects.equals(this.taxes, passengerPricing.taxes);
    }

    @Override
    public int hashCode() {
        return Objects.hash(passengerCount, individualPrice, taxes);
    }

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

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

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

            }.nullSafe();
        }
    }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy