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

com.hopper.cloud.airlines.model.Fare 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.JsonArray;
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;

/**
 * An object detailing a fare
 */
@ApiModel(description = "An object detailing a fare")
@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 Fare {
  public static final String SERIALIZED_NAME_PRICE = "price";
  @SerializedName(SERIALIZED_NAME_PRICE)
  private String price;

  public static final String SERIALIZED_NAME_FARE_BRAND = "fare_brand";
  @SerializedName(SERIALIZED_NAME_FARE_BRAND)
  private String fareBrand;

  public static final String SERIALIZED_NAME_FARE_BASIS = "fare_basis";
  @SerializedName(SERIALIZED_NAME_FARE_BASIS)
  private String fareBasis;

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

  public Fare() { 
  }

  public Fare price(String price) {
      this.price = price;
      return this;
  }

  /**
   * The price of the slice for all the passengers with this fare
   * @return price
   **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "401.10", required = true, value = "The price of the slice for all the passengers with this fare")
  public String getPrice() {
        return price;
    }

  public void setPrice(String price) {
        this.price = price;
    }

  public Fare fareBrand(String fareBrand) {
      this.fareBrand = fareBrand;
      return this;
  }

  /**
   * Name of the fare brand of this fare
   * @return fareBrand
   **/
  @javax.annotation.Nonnull
  @ApiModelProperty(required = false, value = "Name of the fare brand of this fare")

  public String getFareBrand() {
    return fareBrand;
}

  public void setFareBrand(String fareBrand) {
    this.fareBrand = fareBrand;
}

  public Fare fareBasis(String fareBasis) {
      this.fareBasis = fareBasis;
      return this;
  }

  /**
   * Code of the fare basis applied to this fare
   * @return fareBasis
   **/
  @ApiModelProperty(required = false, value = "Code of the fare basis applied to this fare")
  public String getFareBasis() {
     return fareBasis;
  }

  public void setFareBasis(String fareBasis) {
     this.fareBasis = fareBasis;
  }

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

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

  /**
   * The fare rules associated to the fare
   * @return fareRules
   **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The fare rules associated to the fare")

  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;
    }
    Fare fare = (Fare) o;
      return Objects.equals(this.price, fare.price) &&
              Objects.equals(this.fareBrand, fare.fareBrand) &&
              Objects.equals(this.fareBasis, fare.fareBasis) &&
              Objects.equals(this.fareRules, fare.fareRules);
  }

  @Override
  public int hashCode() {
      return Objects.hash(price, fareBrand, fareBasis, fareRules);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Fare {\n");

    sb.append("    price: ").append(toIndentedString(price)).append("\n");
    sb.append("    fareBrand: ").append(toIndentedString(fareBrand)).append("\n");
    sb.append("    fareBasis: ").append(toIndentedString(fareBasis)).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 (!Fare.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'Fare' and its subtypes
       }
       final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(Fare.class));

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

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

       }.nullSafe();
    }
  }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy