/*
 * Michelin North America Order-to-Cash APIs
 * These APIs will help you to do business transactions with Michelin.  <br><br><b>Authentication details:</b><br> <br><u>Option A:</u> OAuth2 Client Credentials (recommended) <br><u>Option B:</u> API Key + Basic Authentication (not recommended) <br><br>To request your access, please contact your representative. <br><br>Our services are based on the EDIWHEEL standards. <br>You can find more information on the <a href=\"https://www.ediwheel.com/\" target=\"_blank\">EDIWHEEL website</a>. 
 *
 * The version of the OpenAPI document: 1.0.1
 * 
 *
 * 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.michelin.adk.amn.o2c.model;

import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerAllowanceOrChargeInner;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerAttachmentsInner;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerBuyerParty;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerConsignee;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerControls;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerHeaderNote;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerInvoiceIssuerParty;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerLineLevelInner;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerPaymentTermsInner;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerReferences;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerSellerParty;
import com.michelin.adk.amn.o2c.model.EDIWheelB34InvoiceListResponseInvoiceInnerSummary;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.michelin.adk.amn.JSON;

/**
 * EDIWheelB34InvoiceListResponseInvoiceInner
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
public class EDIWheelB34InvoiceListResponseInvoiceInner {
  public static final String SERIALIZED_NAME_ISSUE_DATE = "issueDate";
  @SerializedName(SERIALIZED_NAME_ISSUE_DATE)
  @javax.annotation.Nonnull
  private String issueDate;

  public static final String SERIALIZED_NAME_DOCUMENT_NUMBER = "documentNumber";
  @SerializedName(SERIALIZED_NAME_DOCUMENT_NUMBER)
  @javax.annotation.Nonnull
  private String documentNumber;

  public static final String SERIALIZED_NAME_DOCUMENT_TYPE_CODE = "documentTypeCode";
  @SerializedName(SERIALIZED_NAME_DOCUMENT_TYPE_CODE)
  @javax.annotation.Nonnull
  private String documentTypeCode;

  public static final String SERIALIZED_NAME_DOCUMENT_CURRENCY = "documentCurrency";
  @SerializedName(SERIALIZED_NAME_DOCUMENT_CURRENCY)
  @javax.annotation.Nonnull
  private String documentCurrency;

  public static final String SERIALIZED_NAME_REFERENCES = "references";
  @SerializedName(SERIALIZED_NAME_REFERENCES)
  @javax.annotation.Nullable
  private EDIWheelB34InvoiceListResponseInvoiceInnerReferences references;

  public static final String SERIALIZED_NAME_ALLOWANCE_OR_CHARGE = "allowanceOrCharge";
  @SerializedName(SERIALIZED_NAME_ALLOWANCE_OR_CHARGE)
  @javax.annotation.Nullable
  private List<EDIWheelB34InvoiceListResponseInvoiceInnerAllowanceOrChargeInner> allowanceOrCharge = new ArrayList<>();

  public static final String SERIALIZED_NAME_BUYER_PARTY = "buyerParty";
  @SerializedName(SERIALIZED_NAME_BUYER_PARTY)
  @javax.annotation.Nonnull
  private EDIWheelB34InvoiceListResponseInvoiceInnerBuyerParty buyerParty;

  public static final String SERIALIZED_NAME_INVOICE_ISSUER_PARTY = "invoiceIssuerParty";
  @SerializedName(SERIALIZED_NAME_INVOICE_ISSUER_PARTY)
  @javax.annotation.Nullable
  private EDIWheelB34InvoiceListResponseInvoiceInnerInvoiceIssuerParty invoiceIssuerParty;

  public static final String SERIALIZED_NAME_CONSIGNEE = "consignee";
  @SerializedName(SERIALIZED_NAME_CONSIGNEE)
  @javax.annotation.Nullable
  private EDIWheelB34InvoiceListResponseInvoiceInnerConsignee consignee;

  public static final String SERIALIZED_NAME_SELLER_PARTY = "sellerParty";
  @SerializedName(SERIALIZED_NAME_SELLER_PARTY)
  @javax.annotation.Nullable
  private EDIWheelB34InvoiceListResponseInvoiceInnerSellerParty sellerParty;

  public static final String SERIALIZED_NAME_PAYMENT_TERMS = "paymentTerms";
  @SerializedName(SERIALIZED_NAME_PAYMENT_TERMS)
  @javax.annotation.Nullable
  private List<EDIWheelB34InvoiceListResponseInvoiceInnerPaymentTermsInner> paymentTerms = new ArrayList<>();

  public static final String SERIALIZED_NAME_HEADER_NOTE = "headerNote";
  @SerializedName(SERIALIZED_NAME_HEADER_NOTE)
  @javax.annotation.Nullable
  private EDIWheelB34InvoiceListResponseInvoiceInnerHeaderNote headerNote;

  public static final String SERIALIZED_NAME_LINE_LEVEL = "lineLevel";
  @SerializedName(SERIALIZED_NAME_LINE_LEVEL)
  @javax.annotation.Nullable
  private List<EDIWheelB34InvoiceListResponseInvoiceInnerLineLevelInner> lineLevel = new ArrayList<>();

  public static final String SERIALIZED_NAME_CONTROLS = "controls";
  @SerializedName(SERIALIZED_NAME_CONTROLS)
  @javax.annotation.Nullable
  private EDIWheelB34InvoiceListResponseInvoiceInnerControls controls;

  public static final String SERIALIZED_NAME_SUMMARY = "summary";
  @SerializedName(SERIALIZED_NAME_SUMMARY)
  @javax.annotation.Nonnull
  private EDIWheelB34InvoiceListResponseInvoiceInnerSummary summary;

  public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments";
  @SerializedName(SERIALIZED_NAME_ATTACHMENTS)
  @javax.annotation.Nullable
  private List<EDIWheelB34InvoiceListResponseInvoiceInnerAttachmentsInner> attachments = new ArrayList<>();

  public static final String SERIALIZED_NAME_EINVOICING_I_D = "einvoicingID";
  @SerializedName(SERIALIZED_NAME_EINVOICING_I_D)
  @javax.annotation.Nullable
  private List<Object> einvoicingID = new ArrayList<>();

  public EDIWheelB34InvoiceListResponseInvoiceInner() {
  }

  public EDIWheelB34InvoiceListResponseInvoiceInner issueDate(@javax.annotation.Nonnull String issueDate) {
    this.issueDate = issueDate;
    return this;
  }

  /**
   * Invoice Transaction Date in format YYYY-MM-DD
   * @return issueDate
   */
  @javax.annotation.Nonnull
  public String getIssueDate() {
    return issueDate;
  }

  public void setIssueDate(@javax.annotation.Nonnull String issueDate) {
    this.issueDate = issueDate;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner documentNumber(@javax.annotation.Nonnull String documentNumber) {
    this.documentNumber = documentNumber;
    return this;
  }

  /**
   * Invoice, Credit or Debit Number. Format &#x3D; 12 numeric digits. Original delivery invoice prefix &#x3D; 1, Debit memo (3rd party transactions) prefix &#x3D; 1, Correction or Debit prefix &#x3D; 5, Correction or Credit prefix &#x3D; 3.
   * @return documentNumber
   */
  @javax.annotation.Nonnull
  public String getDocumentNumber() {
    return documentNumber;
  }

  public void setDocumentNumber(@javax.annotation.Nonnull String documentNumber) {
    this.documentNumber = documentNumber;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner documentTypeCode(@javax.annotation.Nonnull String documentTypeCode) {
    this.documentTypeCode = documentTypeCode;
    return this;
  }

  /**
   * Document Type Code used in request. Document Type Code descriptions: 380 &#x3D; commercial invoice, 381 &#x3D; credit note, 383 &#x3D; debit note.
   * @return documentTypeCode
   */
  @javax.annotation.Nonnull
  public String getDocumentTypeCode() {
    return documentTypeCode;
  }

  public void setDocumentTypeCode(@javax.annotation.Nonnull String documentTypeCode) {
    this.documentTypeCode = documentTypeCode;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner documentCurrency(@javax.annotation.Nonnull String documentCurrency) {
    this.documentCurrency = documentCurrency;
    return this;
  }

  /**
   * Invoice currency designation. Format &#x3D; three alpha characters: USD (for US Dollar) or CAD (for Canadian Dollar).
   * @return documentCurrency
   */
  @javax.annotation.Nonnull
  public String getDocumentCurrency() {
    return documentCurrency;
  }

  public void setDocumentCurrency(@javax.annotation.Nonnull String documentCurrency) {
    this.documentCurrency = documentCurrency;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner references(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerReferences references) {
    this.references = references;
    return this;
  }

  /**
   * Get references
   * @return references
   */
  @javax.annotation.Nullable
  public EDIWheelB34InvoiceListResponseInvoiceInnerReferences getReferences() {
    return references;
  }

  public void setReferences(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerReferences references) {
    this.references = references;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner allowanceOrCharge(@javax.annotation.Nullable List<EDIWheelB34InvoiceListResponseInvoiceInnerAllowanceOrChargeInner> allowanceOrCharge) {
    this.allowanceOrCharge = allowanceOrCharge;
    return this;
  }

  public EDIWheelB34InvoiceListResponseInvoiceInner addAllowanceOrChargeItem(EDIWheelB34InvoiceListResponseInvoiceInnerAllowanceOrChargeInner allowanceOrChargeItem) {
    if (this.allowanceOrCharge == null) {
      this.allowanceOrCharge = new ArrayList<>();
    }
    this.allowanceOrCharge.add(allowanceOrChargeItem);
    return this;
  }

  /**
   * Get allowanceOrCharge
   * @return allowanceOrCharge
   */
  @javax.annotation.Nullable
  public List<EDIWheelB34InvoiceListResponseInvoiceInnerAllowanceOrChargeInner> getAllowanceOrCharge() {
    return allowanceOrCharge;
  }

  public void setAllowanceOrCharge(@javax.annotation.Nullable List<EDIWheelB34InvoiceListResponseInvoiceInnerAllowanceOrChargeInner> allowanceOrCharge) {
    this.allowanceOrCharge = allowanceOrCharge;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner buyerParty(@javax.annotation.Nonnull EDIWheelB34InvoiceListResponseInvoiceInnerBuyerParty buyerParty) {
    this.buyerParty = buyerParty;
    return this;
  }

  /**
   * Get buyerParty
   * @return buyerParty
   */
  @javax.annotation.Nonnull
  public EDIWheelB34InvoiceListResponseInvoiceInnerBuyerParty getBuyerParty() {
    return buyerParty;
  }

  public void setBuyerParty(@javax.annotation.Nonnull EDIWheelB34InvoiceListResponseInvoiceInnerBuyerParty buyerParty) {
    this.buyerParty = buyerParty;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner invoiceIssuerParty(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerInvoiceIssuerParty invoiceIssuerParty) {
    this.invoiceIssuerParty = invoiceIssuerParty;
    return this;
  }

  /**
   * Get invoiceIssuerParty
   * @return invoiceIssuerParty
   */
  @javax.annotation.Nullable
  public EDIWheelB34InvoiceListResponseInvoiceInnerInvoiceIssuerParty getInvoiceIssuerParty() {
    return invoiceIssuerParty;
  }

  public void setInvoiceIssuerParty(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerInvoiceIssuerParty invoiceIssuerParty) {
    this.invoiceIssuerParty = invoiceIssuerParty;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner consignee(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerConsignee consignee) {
    this.consignee = consignee;
    return this;
  }

  /**
   * Get consignee
   * @return consignee
   */
  @javax.annotation.Nullable
  public EDIWheelB34InvoiceListResponseInvoiceInnerConsignee getConsignee() {
    return consignee;
  }

  public void setConsignee(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerConsignee consignee) {
    this.consignee = consignee;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner sellerParty(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerSellerParty sellerParty) {
    this.sellerParty = sellerParty;
    return this;
  }

  /**
   * Get sellerParty
   * @return sellerParty
   */
  @javax.annotation.Nullable
  public EDIWheelB34InvoiceListResponseInvoiceInnerSellerParty getSellerParty() {
    return sellerParty;
  }

  public void setSellerParty(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerSellerParty sellerParty) {
    this.sellerParty = sellerParty;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner paymentTerms(@javax.annotation.Nullable List<EDIWheelB34InvoiceListResponseInvoiceInnerPaymentTermsInner> paymentTerms) {
    this.paymentTerms = paymentTerms;
    return this;
  }

  public EDIWheelB34InvoiceListResponseInvoiceInner addPaymentTermsItem(EDIWheelB34InvoiceListResponseInvoiceInnerPaymentTermsInner paymentTermsItem) {
    if (this.paymentTerms == null) {
      this.paymentTerms = new ArrayList<>();
    }
    this.paymentTerms.add(paymentTermsItem);
    return this;
  }

  /**
   * Get paymentTerms
   * @return paymentTerms
   */
  @javax.annotation.Nullable
  public List<EDIWheelB34InvoiceListResponseInvoiceInnerPaymentTermsInner> getPaymentTerms() {
    return paymentTerms;
  }

  public void setPaymentTerms(@javax.annotation.Nullable List<EDIWheelB34InvoiceListResponseInvoiceInnerPaymentTermsInner> paymentTerms) {
    this.paymentTerms = paymentTerms;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner headerNote(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerHeaderNote headerNote) {
    this.headerNote = headerNote;
    return this;
  }

  /**
   * Get headerNote
   * @return headerNote
   */
  @javax.annotation.Nullable
  public EDIWheelB34InvoiceListResponseInvoiceInnerHeaderNote getHeaderNote() {
    return headerNote;
  }

  public void setHeaderNote(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerHeaderNote headerNote) {
    this.headerNote = headerNote;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner lineLevel(@javax.annotation.Nullable List<EDIWheelB34InvoiceListResponseInvoiceInnerLineLevelInner> lineLevel) {
    this.lineLevel = lineLevel;
    return this;
  }

  public EDIWheelB34InvoiceListResponseInvoiceInner addLineLevelItem(EDIWheelB34InvoiceListResponseInvoiceInnerLineLevelInner lineLevelItem) {
    if (this.lineLevel == null) {
      this.lineLevel = new ArrayList<>();
    }
    this.lineLevel.add(lineLevelItem);
    return this;
  }

  /**
   * Get lineLevel
   * @return lineLevel
   */
  @javax.annotation.Nullable
  public List<EDIWheelB34InvoiceListResponseInvoiceInnerLineLevelInner> getLineLevel() {
    return lineLevel;
  }

  public void setLineLevel(@javax.annotation.Nullable List<EDIWheelB34InvoiceListResponseInvoiceInnerLineLevelInner> lineLevel) {
    this.lineLevel = lineLevel;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner controls(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerControls controls) {
    this.controls = controls;
    return this;
  }

  /**
   * Get controls
   * @return controls
   */
  @javax.annotation.Nullable
  public EDIWheelB34InvoiceListResponseInvoiceInnerControls getControls() {
    return controls;
  }

  public void setControls(@javax.annotation.Nullable EDIWheelB34InvoiceListResponseInvoiceInnerControls controls) {
    this.controls = controls;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner summary(@javax.annotation.Nonnull EDIWheelB34InvoiceListResponseInvoiceInnerSummary summary) {
    this.summary = summary;
    return this;
  }

  /**
   * Get summary
   * @return summary
   */
  @javax.annotation.Nonnull
  public EDIWheelB34InvoiceListResponseInvoiceInnerSummary getSummary() {
    return summary;
  }

  public void setSummary(@javax.annotation.Nonnull EDIWheelB34InvoiceListResponseInvoiceInnerSummary summary) {
    this.summary = summary;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner attachments(@javax.annotation.Nullable List<EDIWheelB34InvoiceListResponseInvoiceInnerAttachmentsInner> attachments) {
    this.attachments = attachments;
    return this;
  }

  public EDIWheelB34InvoiceListResponseInvoiceInner addAttachmentsItem(EDIWheelB34InvoiceListResponseInvoiceInnerAttachmentsInner attachmentsItem) {
    if (this.attachments == null) {
      this.attachments = new ArrayList<>();
    }
    this.attachments.add(attachmentsItem);
    return this;
  }

  /**
   * If attachment indicator \&quot;2\&quot; or \&quot;3\&quot; is used in request, additional PDF Base64 details are displayed to allow for PDF conversion.
   * @return attachments
   */
  @javax.annotation.Nullable
  public List<EDIWheelB34InvoiceListResponseInvoiceInnerAttachmentsInner> getAttachments() {
    return attachments;
  }

  public void setAttachments(@javax.annotation.Nullable List<EDIWheelB34InvoiceListResponseInvoiceInnerAttachmentsInner> attachments) {
    this.attachments = attachments;
  }


  public EDIWheelB34InvoiceListResponseInvoiceInner einvoicingID(@javax.annotation.Nullable List<Object> einvoicingID) {
    this.einvoicingID = einvoicingID;
    return this;
  }

  public EDIWheelB34InvoiceListResponseInvoiceInner addEinvoicingIDItem(Object einvoicingIDItem) {
    if (this.einvoicingID == null) {
      this.einvoicingID = new ArrayList<>();
    }
    this.einvoicingID.add(einvoicingIDItem);
    return this;
  }

  /**
   * Get einvoicingID
   * @return einvoicingID
   */
  @javax.annotation.Nullable
  public List<Object> getEinvoicingID() {
    return einvoicingID;
  }

  public void setEinvoicingID(@javax.annotation.Nullable List<Object> einvoicingID) {
    this.einvoicingID = einvoicingID;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    EDIWheelB34InvoiceListResponseInvoiceInner edIWheelB34InvoiceListResponseInvoiceInner = (EDIWheelB34InvoiceListResponseInvoiceInner) o;
    return Objects.equals(this.issueDate, edIWheelB34InvoiceListResponseInvoiceInner.issueDate) &&
        Objects.equals(this.documentNumber, edIWheelB34InvoiceListResponseInvoiceInner.documentNumber) &&
        Objects.equals(this.documentTypeCode, edIWheelB34InvoiceListResponseInvoiceInner.documentTypeCode) &&
        Objects.equals(this.documentCurrency, edIWheelB34InvoiceListResponseInvoiceInner.documentCurrency) &&
        Objects.equals(this.references, edIWheelB34InvoiceListResponseInvoiceInner.references) &&
        Objects.equals(this.allowanceOrCharge, edIWheelB34InvoiceListResponseInvoiceInner.allowanceOrCharge) &&
        Objects.equals(this.buyerParty, edIWheelB34InvoiceListResponseInvoiceInner.buyerParty) &&
        Objects.equals(this.invoiceIssuerParty, edIWheelB34InvoiceListResponseInvoiceInner.invoiceIssuerParty) &&
        Objects.equals(this.consignee, edIWheelB34InvoiceListResponseInvoiceInner.consignee) &&
        Objects.equals(this.sellerParty, edIWheelB34InvoiceListResponseInvoiceInner.sellerParty) &&
        Objects.equals(this.paymentTerms, edIWheelB34InvoiceListResponseInvoiceInner.paymentTerms) &&
        Objects.equals(this.headerNote, edIWheelB34InvoiceListResponseInvoiceInner.headerNote) &&
        Objects.equals(this.lineLevel, edIWheelB34InvoiceListResponseInvoiceInner.lineLevel) &&
        Objects.equals(this.controls, edIWheelB34InvoiceListResponseInvoiceInner.controls) &&
        Objects.equals(this.summary, edIWheelB34InvoiceListResponseInvoiceInner.summary) &&
        Objects.equals(this.attachments, edIWheelB34InvoiceListResponseInvoiceInner.attachments) &&
        Objects.equals(this.einvoicingID, edIWheelB34InvoiceListResponseInvoiceInner.einvoicingID);
  }

  @Override
  public int hashCode() {
    return Objects.hash(issueDate, documentNumber, documentTypeCode, documentCurrency, references, allowanceOrCharge, buyerParty, invoiceIssuerParty, consignee, sellerParty, paymentTerms, headerNote, lineLevel, controls, summary, attachments, einvoicingID);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class EDIWheelB34InvoiceListResponseInvoiceInner {\n");
    sb.append("    issueDate: ").append(toIndentedString(issueDate)).append("\n");
    sb.append("    documentNumber: ").append(toIndentedString(documentNumber)).append("\n");
    sb.append("    documentTypeCode: ").append(toIndentedString(documentTypeCode)).append("\n");
    sb.append("    documentCurrency: ").append(toIndentedString(documentCurrency)).append("\n");
    sb.append("    references: ").append(toIndentedString(references)).append("\n");
    sb.append("    allowanceOrCharge: ").append(toIndentedString(allowanceOrCharge)).append("\n");
    sb.append("    buyerParty: ").append(toIndentedString(buyerParty)).append("\n");
    sb.append("    invoiceIssuerParty: ").append(toIndentedString(invoiceIssuerParty)).append("\n");
    sb.append("    consignee: ").append(toIndentedString(consignee)).append("\n");
    sb.append("    sellerParty: ").append(toIndentedString(sellerParty)).append("\n");
    sb.append("    paymentTerms: ").append(toIndentedString(paymentTerms)).append("\n");
    sb.append("    headerNote: ").append(toIndentedString(headerNote)).append("\n");
    sb.append("    lineLevel: ").append(toIndentedString(lineLevel)).append("\n");
    sb.append("    controls: ").append(toIndentedString(controls)).append("\n");
    sb.append("    summary: ").append(toIndentedString(summary)).append("\n");
    sb.append("    attachments: ").append(toIndentedString(attachments)).append("\n");
    sb.append("    einvoicingID: ").append(toIndentedString(einvoicingID)).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 HashSet<String> openapiFields;
  public static HashSet<String> openapiRequiredFields;

  static {
    // a set of all properties/fields (JSON key names)
    openapiFields = new HashSet<String>();
    openapiFields.add("issueDate");
    openapiFields.add("documentNumber");
    openapiFields.add("documentTypeCode");
    openapiFields.add("documentCurrency");
    openapiFields.add("references");
    openapiFields.add("allowanceOrCharge");
    openapiFields.add("buyerParty");
    openapiFields.add("invoiceIssuerParty");
    openapiFields.add("consignee");
    openapiFields.add("sellerParty");
    openapiFields.add("paymentTerms");
    openapiFields.add("headerNote");
    openapiFields.add("lineLevel");
    openapiFields.add("controls");
    openapiFields.add("summary");
    openapiFields.add("attachments");
    openapiFields.add("einvoicingID");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet<String>();
    openapiRequiredFields.add("issueDate");
    openapiRequiredFields.add("documentNumber");
    openapiRequiredFields.add("documentTypeCode");
    openapiRequiredFields.add("documentCurrency");
    openapiRequiredFields.add("buyerParty");
    openapiRequiredFields.add("summary");
  }

  /**
   * Validates the JSON Element and throws an exception if issues found
   *
   * @param jsonElement JSON Element
   * @throws IOException if the JSON Element is invalid with respect to EDIWheelB34InvoiceListResponseInvoiceInner
   */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!EDIWheelB34InvoiceListResponseInvoiceInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in EDIWheelB34InvoiceListResponseInvoiceInner is not found in the empty JSON string", EDIWheelB34InvoiceListResponseInvoiceInner.openapiRequiredFields.toString()));
        }
      }

      Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
      // check to see if the JSON string contains additional fields
      for (Map.Entry<String, JsonElement> entry : entries) {
        if (!EDIWheelB34InvoiceListResponseInvoiceInner.openapiFields.contains(entry.getKey())) {
          throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EDIWheelB34InvoiceListResponseInvoiceInner` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
        }
      }

      // check to make sure all required properties/fields are present in the JSON string
      for (String requiredField : EDIWheelB34InvoiceListResponseInvoiceInner.openapiRequiredFields) {
        if (jsonElement.getAsJsonObject().get(requiredField) == null) {
          throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
      if (!jsonObj.get("issueDate").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `issueDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("issueDate").toString()));
      }
      if (!jsonObj.get("documentNumber").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `documentNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("documentNumber").toString()));
      }
      if (!jsonObj.get("documentTypeCode").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `documentTypeCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("documentTypeCode").toString()));
      }
      if (!jsonObj.get("documentCurrency").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `documentCurrency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("documentCurrency").toString()));
      }
      // validate the optional field `references`
      if (jsonObj.get("references") != null && !jsonObj.get("references").isJsonNull()) {
        EDIWheelB34InvoiceListResponseInvoiceInnerReferences.validateJsonElement(jsonObj.get("references"));
      }
      if (jsonObj.get("allowanceOrCharge") != null && !jsonObj.get("allowanceOrCharge").isJsonNull()) {
        JsonArray jsonArrayallowanceOrCharge = jsonObj.getAsJsonArray("allowanceOrCharge");
        if (jsonArrayallowanceOrCharge != null) {
          // ensure the json data is an array
          if (!jsonObj.get("allowanceOrCharge").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `allowanceOrCharge` to be an array in the JSON string but got `%s`", jsonObj.get("allowanceOrCharge").toString()));
          }

          // validate the optional field `allowanceOrCharge` (array)
          for (int i = 0; i < jsonArrayallowanceOrCharge.size(); i++) {
            EDIWheelB34InvoiceListResponseInvoiceInnerAllowanceOrChargeInner.validateJsonElement(jsonArrayallowanceOrCharge.get(i));
          };
        }
      }
      // validate the required field `buyerParty`
      EDIWheelB34InvoiceListResponseInvoiceInnerBuyerParty.validateJsonElement(jsonObj.get("buyerParty"));
      // validate the optional field `invoiceIssuerParty`
      if (jsonObj.get("invoiceIssuerParty") != null && !jsonObj.get("invoiceIssuerParty").isJsonNull()) {
        EDIWheelB34InvoiceListResponseInvoiceInnerInvoiceIssuerParty.validateJsonElement(jsonObj.get("invoiceIssuerParty"));
      }
      // validate the optional field `consignee`
      if (jsonObj.get("consignee") != null && !jsonObj.get("consignee").isJsonNull()) {
        EDIWheelB34InvoiceListResponseInvoiceInnerConsignee.validateJsonElement(jsonObj.get("consignee"));
      }
      // validate the optional field `sellerParty`
      if (jsonObj.get("sellerParty") != null && !jsonObj.get("sellerParty").isJsonNull()) {
        EDIWheelB34InvoiceListResponseInvoiceInnerSellerParty.validateJsonElement(jsonObj.get("sellerParty"));
      }
      if (jsonObj.get("paymentTerms") != null && !jsonObj.get("paymentTerms").isJsonNull()) {
        JsonArray jsonArraypaymentTerms = jsonObj.getAsJsonArray("paymentTerms");
        if (jsonArraypaymentTerms != null) {
          // ensure the json data is an array
          if (!jsonObj.get("paymentTerms").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `paymentTerms` to be an array in the JSON string but got `%s`", jsonObj.get("paymentTerms").toString()));
          }

          // validate the optional field `paymentTerms` (array)
          for (int i = 0; i < jsonArraypaymentTerms.size(); i++) {
            EDIWheelB34InvoiceListResponseInvoiceInnerPaymentTermsInner.validateJsonElement(jsonArraypaymentTerms.get(i));
          };
        }
      }
      // validate the optional field `headerNote`
      if (jsonObj.get("headerNote") != null && !jsonObj.get("headerNote").isJsonNull()) {
        EDIWheelB34InvoiceListResponseInvoiceInnerHeaderNote.validateJsonElement(jsonObj.get("headerNote"));
      }
      if (jsonObj.get("lineLevel") != null && !jsonObj.get("lineLevel").isJsonNull()) {
        JsonArray jsonArraylineLevel = jsonObj.getAsJsonArray("lineLevel");
        if (jsonArraylineLevel != null) {
          // ensure the json data is an array
          if (!jsonObj.get("lineLevel").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `lineLevel` to be an array in the JSON string but got `%s`", jsonObj.get("lineLevel").toString()));
          }

          // validate the optional field `lineLevel` (array)
          for (int i = 0; i < jsonArraylineLevel.size(); i++) {
            EDIWheelB34InvoiceListResponseInvoiceInnerLineLevelInner.validateJsonElement(jsonArraylineLevel.get(i));
          };
        }
      }
      // validate the optional field `controls`
      if (jsonObj.get("controls") != null && !jsonObj.get("controls").isJsonNull()) {
        EDIWheelB34InvoiceListResponseInvoiceInnerControls.validateJsonElement(jsonObj.get("controls"));
      }
      // validate the required field `summary`
      EDIWheelB34InvoiceListResponseInvoiceInnerSummary.validateJsonElement(jsonObj.get("summary"));
      if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull()) {
        JsonArray jsonArrayattachments = jsonObj.getAsJsonArray("attachments");
        if (jsonArrayattachments != null) {
          // ensure the json data is an array
          if (!jsonObj.get("attachments").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString()));
          }

          // validate the optional field `attachments` (array)
          for (int i = 0; i < jsonArrayattachments.size(); i++) {
            EDIWheelB34InvoiceListResponseInvoiceInnerAttachmentsInner.validateJsonElement(jsonArrayattachments.get(i));
          };
        }
      }
      // ensure the optional json data is an array if present
      if (jsonObj.get("einvoicingID") != null && !jsonObj.get("einvoicingID").isJsonNull() && !jsonObj.get("einvoicingID").isJsonArray()) {
        throw new IllegalArgumentException(String.format("Expected the field `einvoicingID` to be an array in the JSON string but got `%s`", jsonObj.get("einvoicingID").toString()));
      }
  }

  public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
    @SuppressWarnings("unchecked")
    @Override
    public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
       if (!EDIWheelB34InvoiceListResponseInvoiceInner.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'EDIWheelB34InvoiceListResponseInvoiceInner' and its subtypes
       }
       final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter<EDIWheelB34InvoiceListResponseInvoiceInner> thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(EDIWheelB34InvoiceListResponseInvoiceInner.class));

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

           @Override
           public EDIWheelB34InvoiceListResponseInvoiceInner read(JsonReader in) throws IOException {
             JsonElement jsonElement = elementAdapter.read(in);
             validateJsonElement(jsonElement);
             return thisAdapter.fromJsonTree(jsonElement);
           }

       }.nullSafe();
    }
  }

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

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

