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

com.hopper.cloud.airlines.model.Ancillary 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 com.hopper.cloud.airlines.model.AncillaryType;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;

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;

/**
 * Ancillary
 */
@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 Ancillary {
    public static final String SERIALIZED_NAME_TOTAL_PRICE = "total_price";
    @SerializedName(SERIALIZED_NAME_TOTAL_PRICE)
    private String totalPrice;

    public static final String SERIALIZED_NAME_PASSENGER_REFERENCE = "passenger_reference";
    @SerializedName(SERIALIZED_NAME_PASSENGER_REFERENCE)
    private String passengerReference;

    public static final String SERIALIZED_NAME_TYPE = "type";
    @SerializedName(SERIALIZED_NAME_TYPE)
    private AncillaryType type;

    public static final String SERIALIZED_NAME_COVERED = "covered";
    @SerializedName(SERIALIZED_NAME_COVERED)
    private Boolean covered;

    public Ancillary() {
    }

    public Ancillary totalPrice(String totalPrice) {

        this.totalPrice = totalPrice;
        return this;
    }

    /**
     * Total price of ancillaries of this type attached to fare
     * @return totalPrice
     **/
    @javax.annotation.Nonnull
    @ApiModelProperty(example = "20.55", required = true, value = "Total price of ancillaries of this type attached to fare")

    public String getTotalPrice() {
        return totalPrice;
    }


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

    public Ancillary passengerReference(String passengerReference) {
        this.passengerReference = passengerReference;
        return this;
    }

    public String getPassengerReference() {
        return passengerReference;
    }

    public void setPassengerReference(String passengerReference) {
        this.passengerReference = passengerReference;
    }


    public Ancillary type(AncillaryType type) {

        this.type = type;
        return this;
    }

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

    public AncillaryType getType() {
        return type;
    }


    public void setType(AncillaryType type) {
        this.type = type;
    }


    public Ancillary covered(Boolean covered) {
        this.covered = covered;
        return this;
    }

    /**
     * Is this ancillary covered by the product. By default true if not specified
     * @return covered
     **/
    @ApiModelProperty(value = "Is this ancillary covered by the product. By default true if not specified")
    public Boolean isCovered() {
        return covered;
    }

    public void setCovered(Boolean covered) {
        this.covered = covered;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Ancillary ancillary = (Ancillary) o;
        return Objects.equals(this.totalPrice, ancillary.totalPrice) &&
                Objects.equals(this.passengerReference, ancillary.passengerReference) &&
                Objects.equals(this.type, ancillary.type) &&
                Objects.equals(this.covered, ancillary.covered);
    }

    @Override
    public int hashCode() {
        return Objects.hash(totalPrice, passengerReference, type, covered);
    }

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

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

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

            }.nullSafe();
        }
    }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy