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

com.hopper.cloud.airlines.model.CfarPassenger 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 com.fasterxml.jackson.annotation.JsonInclude;
import com.google.gson.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.hopper.cloud.airlines.JSON;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.IOException;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;

/**
 * An object detailing a passenger
 */
@ApiModel(description = "An object detailing a passenger")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CfarPassenger {
    public static final String SERIALIZED_NAME_PASSENGER_REFERENCE = "passenger_reference";
    @SerializedName(SERIALIZED_NAME_PASSENGER_REFERENCE)
    private String passengerReference;

    public static final String SERIALIZED_NAME_PASSENGER_TYPE = "passenger_type";
    @SerializedName(SERIALIZED_NAME_PASSENGER_TYPE)
    private PassengerType passengerType;

    public static final String SERIALIZED_NAME_FIRST_NAME = "first_name";
    @SerializedName(SERIALIZED_NAME_FIRST_NAME)
    private String firstName;

    public static final String SERIALIZED_NAME_LAST_NAME = "last_name";
    @SerializedName(SERIALIZED_NAME_LAST_NAME)
    private String lastName;

    public static final String SERIALIZED_NAME_DATE_OF_BIRTH = "date_of_birth";
    @SerializedName(SERIALIZED_NAME_DATE_OF_BIRTH)
    private String dateOfBirth;

    public static final String SERIALIZED_NAME_GENDER = "gender";
    @SerializedName(SERIALIZED_NAME_GENDER)
    private Gender gender;

    public CfarPassenger() {
    }

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

    @javax.annotation.Nonnull
    public String getPassengerReference() {
        return passengerReference;
    }

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

    public CfarPassenger passengerType(PassengerType passengerType) {
        this.passengerType = passengerType;
        return this;
    }

    /**
     * Get passenger type
     * @return type
     **/
    @javax.annotation.Nonnull
    @ApiModelProperty(required = true, value = "")
    public PassengerType getPassengerType() {
        return passengerType;
    }


    public void setPassengerType(PassengerType passengerType) {
        this.passengerType = passengerType;
    }

    public CfarPassenger firstName(String firstName) {

        this.firstName = firstName;
        return this;
    }

    /**
     * The first name of the passenger
     *
     * @return firstName
     **/
    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public CfarPassenger lastName(String lastName) {

        this.lastName = lastName;
        return this;
    }

    /**
     * The last name of the passenger
     *
     * @return lastName
     **/
    public String getLastName() {
        return lastName;
    }


    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public CfarPassenger dateOfBirth(String dateOfBirth) {

        this.dateOfBirth = dateOfBirth;
        return this;
    }

    /**
     * The birth date in ISO Local Date format
     * @return dateOfBirth
     **/
    @ApiModelProperty(example = "2000-04-02", value = "The birth date in ISO Local Date format")
    public String getDateOfBirth() {
        return dateOfBirth;
    }


    public void setDateOfBirth(String dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    public CfarPassenger gender(Gender gender) {
        this.gender = gender;
        return this;
    }

    /**
     * Get gender
     * @return type
     **/
    public Gender getGender() {
        return gender;
    }


    public void setGender(Gender gender) {
        this.gender = gender;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CfarPassenger cfarPassenger = (CfarPassenger) o;
        return Objects.equals(this.passengerReference, cfarPassenger.passengerReference) &&
                Objects.equals(this.passengerType, cfarPassenger.passengerType) &&
                Objects.equals(this.firstName, cfarPassenger.firstName) &&
                Objects.equals(this.lastName, cfarPassenger.lastName) &&
                Objects.equals(this.dateOfBirth, cfarPassenger.dateOfBirth) &&
                Objects.equals(this.gender, cfarPassenger.gender);
    }

    @Override
    public int hashCode() {
        return Objects.hash(passengerReference, passengerType, firstName, lastName, dateOfBirth, gender);
    }

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

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

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

            }.nullSafe();
        }
    }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy