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

com.zuora.model.ExpandedCreditMemoItem Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
/*
 * Zuora API Reference
 * REST API reference for the Zuora Billing, Payments, and Central Platform! Check out the [REST API Overview](https://www.zuora.com/developer/api-references/api/overview/).
 *
 * The version of the OpenAPI document: 2024-05-20
 * Contact: [email protected]
 *
 * 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.zuora.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.zuora.model.ExpandedRatePlanCharge;
import com.zuora.model.ExpandedSubscription;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Arrays;

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.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.zuora.JSON;

/**
 * ExpandedCreditMemoItem
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class ExpandedCreditMemoItem {
  public static final String SERIALIZED_NAME_AMOUNT = "amount";
  @SerializedName(SERIALIZED_NAME_AMOUNT)
  private BigDecimal amount;

  public static final String SERIALIZED_NAME_AMOUNT_WITHOUT_TAX = "amountWithoutTax";
  @SerializedName(SERIALIZED_NAME_AMOUNT_WITHOUT_TAX)
  private BigDecimal amountWithoutTax;

  public static final String SERIALIZED_NAME_APPLIED_TO_ITEM_ID = "appliedToItemId";
  @SerializedName(SERIALIZED_NAME_APPLIED_TO_ITEM_ID)
  private String appliedToItemId;

  public static final String SERIALIZED_NAME_APPLIED_TO_OTHERS_AMOUNT = "appliedToOthersAmount";
  @SerializedName(SERIALIZED_NAME_APPLIED_TO_OTHERS_AMOUNT)
  private BigDecimal appliedToOthersAmount;

  public static final String SERIALIZED_NAME_BE_APPLIED_BY_OTHERS_AMOUNT = "beAppliedByOthersAmount";
  @SerializedName(SERIALIZED_NAME_BE_APPLIED_BY_OTHERS_AMOUNT)
  private BigDecimal beAppliedByOthersAmount;

  public static final String SERIALIZED_NAME_CHARGE_DATE = "chargeDate";
  @SerializedName(SERIALIZED_NAME_CHARGE_DATE)
  private String chargeDate;

  public static final String SERIALIZED_NAME_DESCRIPTION = "description";
  @SerializedName(SERIALIZED_NAME_DESCRIPTION)
  private String description;

  public static final String SERIALIZED_NAME_EXCLUDE_ITEM_BILLING_FROM_REVENUE_ACCOUNTING = "excludeItemBillingFromRevenueAccounting";
  @SerializedName(SERIALIZED_NAME_EXCLUDE_ITEM_BILLING_FROM_REVENUE_ACCOUNTING)
  private Boolean excludeItemBillingFromRevenueAccounting;

  public static final String SERIALIZED_NAME_FULFILLMENT_ID = "fulfillmentId";
  @SerializedName(SERIALIZED_NAME_FULFILLMENT_ID)
  private String fulfillmentId;

  public static final String SERIALIZED_NAME_INVOICE_SCHEDULE_ID = "invoiceScheduleId";
  @SerializedName(SERIALIZED_NAME_INVOICE_SCHEDULE_ID)
  private String invoiceScheduleId;

  public static final String SERIALIZED_NAME_INVOICE_SCHEDULE_ITEM_ID = "invoiceScheduleItemId";
  @SerializedName(SERIALIZED_NAME_INVOICE_SCHEDULE_ITEM_ID)
  private String invoiceScheduleItemId;

  public static final String SERIALIZED_NAME_ITEM_SOLD_TO_CONTACT_ID = "itemSoldToContactId";
  @SerializedName(SERIALIZED_NAME_ITEM_SOLD_TO_CONTACT_ID)
  private String itemSoldToContactId;

  public static final String SERIALIZED_NAME_ITEM_SOLD_TO_CONTACT_SNAPSHOT_ID = "itemSoldToContactSnapshotId";
  @SerializedName(SERIALIZED_NAME_ITEM_SOLD_TO_CONTACT_SNAPSHOT_ID)
  private String itemSoldToContactSnapshotId;

  public static final String SERIALIZED_NAME_ITEM_TYPE = "itemType";
  @SerializedName(SERIALIZED_NAME_ITEM_TYPE)
  private String itemType;

  public static final String SERIALIZED_NAME_ORDER_LINE_ITEM_ID = "orderLineItemId";
  @SerializedName(SERIALIZED_NAME_ORDER_LINE_ITEM_ID)
  private String orderLineItemId;

  public static final String SERIALIZED_NAME_PROCESSING_TYPE = "processingType";
  @SerializedName(SERIALIZED_NAME_PROCESSING_TYPE)
  private String processingType;

  public static final String SERIALIZED_NAME_PURCHASE_ORDER_NUMBER = "purchaseOrderNumber";
  @SerializedName(SERIALIZED_NAME_PURCHASE_ORDER_NUMBER)
  private String purchaseOrderNumber;

  public static final String SERIALIZED_NAME_QUANTITY = "quantity";
  @SerializedName(SERIALIZED_NAME_QUANTITY)
  private BigDecimal quantity;

  public static final String SERIALIZED_NAME_CREDIT_FROM_ITEM_SOURCE = "creditFromItemSource";
  @SerializedName(SERIALIZED_NAME_CREDIT_FROM_ITEM_SOURCE)
  private String creditFromItemSource;

  public static final String SERIALIZED_NAME_CREDIT_FROM_ITEM_ID = "creditFromItemId";
  @SerializedName(SERIALIZED_NAME_CREDIT_FROM_ITEM_ID)
  private String creditFromItemId;

  public static final String SERIALIZED_NAME_SERVICE_END_DATE = "serviceEndDate";
  @SerializedName(SERIALIZED_NAME_SERVICE_END_DATE)
  private LocalDate serviceEndDate;

  public static final String SERIALIZED_NAME_SERVICE_START_DATE = "serviceStartDate";
  @SerializedName(SERIALIZED_NAME_SERVICE_START_DATE)
  private LocalDate serviceStartDate;

  public static final String SERIALIZED_NAME_SKU = "sku";
  @SerializedName(SERIALIZED_NAME_SKU)
  private String sku;

  public static final String SERIALIZED_NAME_SOURCE_ITEM_TYPE = "sourceItemType";
  @SerializedName(SERIALIZED_NAME_SOURCE_ITEM_TYPE)
  private String sourceItemType;

  public static final String SERIALIZED_NAME_CHARGE_NAME = "chargeName";
  @SerializedName(SERIALIZED_NAME_CHARGE_NAME)
  private String chargeName;

  public static final String SERIALIZED_NAME_CHARGE_NUMBER = "chargeNumber";
  @SerializedName(SERIALIZED_NAME_CHARGE_NUMBER)
  private String chargeNumber;

  public static final String SERIALIZED_NAME_COMMITMENT_CHARGE_SEGMENT_NUMBER = "commitmentChargeSegmentNumber";
  @SerializedName(SERIALIZED_NAME_COMMITMENT_CHARGE_SEGMENT_NUMBER)
  private String commitmentChargeSegmentNumber;

  public static final String SERIALIZED_NAME_COMMITMENT_CHARGE_NUMBER = "commitmentChargeNumber";
  @SerializedName(SERIALIZED_NAME_COMMITMENT_CHARGE_NUMBER)
  private String commitmentChargeNumber;

  public static final String SERIALIZED_NAME_TAX_AMOUNT = "taxAmount";
  @SerializedName(SERIALIZED_NAME_TAX_AMOUNT)
  private BigDecimal taxAmount;

  public static final String SERIALIZED_NAME_TAX_CODE_NAME = "taxCodeName";
  @SerializedName(SERIALIZED_NAME_TAX_CODE_NAME)
  private String taxCodeName;

  public static final String SERIALIZED_NAME_TAX_EXEMPT_AMOUNT = "taxExemptAmount";
  @SerializedName(SERIALIZED_NAME_TAX_EXEMPT_AMOUNT)
  private BigDecimal taxExemptAmount;

  public static final String SERIALIZED_NAME_TAX_MODE = "taxMode";
  @SerializedName(SERIALIZED_NAME_TAX_MODE)
  private String taxMode;

  public static final String SERIALIZED_NAME_UNIT_OF_MEASURE = "unitOfMeasure";
  @SerializedName(SERIALIZED_NAME_UNIT_OF_MEASURE)
  private String unitOfMeasure;

  public static final String SERIALIZED_NAME_UNIT_PRICE = "unitPrice";
  @SerializedName(SERIALIZED_NAME_UNIT_PRICE)
  private BigDecimal unitPrice;

  public static final String SERIALIZED_NAME_UNAPPLIED_AMOUNT = "unappliedAmount";
  @SerializedName(SERIALIZED_NAME_UNAPPLIED_AMOUNT)
  private BigDecimal unappliedAmount;

  public static final String SERIALIZED_NAME_SUBSCRIPTION_ID = "subscriptionId";
  @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_ID)
  private String subscriptionId;

  public static final String SERIALIZED_NAME_SUBSCRIPTION_NUMBER = "subscriptionNumber";
  @SerializedName(SERIALIZED_NAME_SUBSCRIPTION_NUMBER)
  private String subscriptionNumber;

  public static final String SERIALIZED_NAME_INVOICE_ITEM_ID = "invoiceItemId";
  @SerializedName(SERIALIZED_NAME_INVOICE_ITEM_ID)
  private String invoiceItemId;

  public static final String SERIALIZED_NAME_PRODUCT_RATE_PLAN_CHARGE_ID = "productRatePlanChargeId";
  @SerializedName(SERIALIZED_NAME_PRODUCT_RATE_PLAN_CHARGE_ID)
  private String productRatePlanChargeId;

  public static final String SERIALIZED_NAME_RATE_PLAN_CHARGE_ID = "ratePlanChargeId";
  @SerializedName(SERIALIZED_NAME_RATE_PLAN_CHARGE_ID)
  private String ratePlanChargeId;

  public static final String SERIALIZED_NAME_REVENUE_RECOGNITION_RULE_NAME = "revenueRecognitionRuleName";
  @SerializedName(SERIALIZED_NAME_REVENUE_RECOGNITION_RULE_NAME)
  private String revenueRecognitionRuleName;

  public static final String SERIALIZED_NAME_CREDIT_MEMO_ID = "creditMemoId";
  @SerializedName(SERIALIZED_NAME_CREDIT_MEMO_ID)
  private String creditMemoId;

  public static final String SERIALIZED_NAME_NUMBER_OF_DELIVERIES = "numberOfDeliveries";
  @SerializedName(SERIALIZED_NAME_NUMBER_OF_DELIVERIES)
  private BigDecimal numberOfDeliveries;

  public static final String SERIALIZED_NAME_REFLECT_DISCOUNT_IN_NET_AMOUNT = "reflectDiscountInNetAmount";
  @SerializedName(SERIALIZED_NAME_REFLECT_DISCOUNT_IN_NET_AMOUNT)
  private Boolean reflectDiscountInNetAmount;

  public static final String SERIALIZED_NAME_ID = "id";
  @SerializedName(SERIALIZED_NAME_ID)
  private String id;

  public static final String SERIALIZED_NAME_CREATED_BY_ID = "createdById";
  @SerializedName(SERIALIZED_NAME_CREATED_BY_ID)
  private String createdById;

  public static final String SERIALIZED_NAME_CREATED_DATE = "createdDate";
  @SerializedName(SERIALIZED_NAME_CREATED_DATE)
  private String createdDate;

  public static final String SERIALIZED_NAME_UPDATED_BY_ID = "updatedById";
  @SerializedName(SERIALIZED_NAME_UPDATED_BY_ID)
  private String updatedById;

  public static final String SERIALIZED_NAME_UPDATED_DATE = "updatedDate";
  @SerializedName(SERIALIZED_NAME_UPDATED_DATE)
  private String updatedDate;

  public static final String SERIALIZED_NAME_RECOGNIZED_REVENUE_ACCOUNTING_CODE_ID = "recognizedRevenueAccountingCodeId";
  @SerializedName(SERIALIZED_NAME_RECOGNIZED_REVENUE_ACCOUNTING_CODE_ID)
  private String recognizedRevenueAccountingCodeId;

  public static final String SERIALIZED_NAME_ACCOUNT_RECEIVABLE_ACCOUNTING_CODE_ID = "accountReceivableAccountingCodeId";
  @SerializedName(SERIALIZED_NAME_ACCOUNT_RECEIVABLE_ACCOUNTING_CODE_ID)
  private String accountReceivableAccountingCodeId;

  public static final String SERIALIZED_NAME_ON_ACCOUNT_ACCOUNTING_CODE_ID = "onAccountAccountingCodeId";
  @SerializedName(SERIALIZED_NAME_ON_ACCOUNT_ACCOUNTING_CODE_ID)
  private String onAccountAccountingCodeId;

  public static final String SERIALIZED_NAME_DEFERRED_REVENUE_ACCOUNTING_CODE_ID = "deferredRevenueAccountingCodeId";
  @SerializedName(SERIALIZED_NAME_DEFERRED_REVENUE_ACCOUNTING_CODE_ID)
  private String deferredRevenueAccountingCodeId;

  public static final String SERIALIZED_NAME_NON_REVENUE_WRITE_OFF_ACCOUNTING_CODE_ID = "nonRevenueWriteOffAccountingCodeId";
  @SerializedName(SERIALIZED_NAME_NON_REVENUE_WRITE_OFF_ACCOUNTING_CODE_ID)
  private String nonRevenueWriteOffAccountingCodeId;

  public static final String SERIALIZED_NAME_JOURNAL_ENTRY_ID = "journalEntryId";
  @SerializedName(SERIALIZED_NAME_JOURNAL_ENTRY_ID)
  private String journalEntryId;

  public static final String SERIALIZED_NAME_SOLD_TO_CONTACT_SNAPSHOT_ID = "soldToContactSnapshotId";
  @SerializedName(SERIALIZED_NAME_SOLD_TO_CONTACT_SNAPSHOT_ID)
  private String soldToContactSnapshotId;

  public static final String SERIALIZED_NAME_BILL_TO_CONTACT_SNAPSHOT_ID = "billToContactSnapshotId";
  @SerializedName(SERIALIZED_NAME_BILL_TO_CONTACT_SNAPSHOT_ID)
  private String billToContactSnapshotId;

  public static final String SERIALIZED_NAME_DEBIT_MEMO_ITEM_ID = "debitMemoItemId";
  @SerializedName(SERIALIZED_NAME_DEBIT_MEMO_ITEM_ID)
  private String debitMemoItemId;

  public static final String SERIALIZED_NAME_SUBSCRIPTION = "subscription";
  @SerializedName(SERIALIZED_NAME_SUBSCRIPTION)
  private ExpandedSubscription subscription;

  public static final String SERIALIZED_NAME_RATE_PLAN_CHARGE = "ratePlanCharge";
  @SerializedName(SERIALIZED_NAME_RATE_PLAN_CHARGE)
  private ExpandedRatePlanCharge ratePlanCharge;

  public ExpandedCreditMemoItem() {
  }

  public ExpandedCreditMemoItem amount(BigDecimal amount) {
    this.amount = amount;
    return this;
  }

  /**
   * Get amount
   * @return amount
   */
  @javax.annotation.Nullable
  public BigDecimal getAmount() {
    return amount;
  }

  public void setAmount(BigDecimal amount) {
    this.amount = amount;
  }


  public ExpandedCreditMemoItem amountWithoutTax(BigDecimal amountWithoutTax) {
    this.amountWithoutTax = amountWithoutTax;
    return this;
  }

  /**
   * Get amountWithoutTax
   * @return amountWithoutTax
   */
  @javax.annotation.Nullable
  public BigDecimal getAmountWithoutTax() {
    return amountWithoutTax;
  }

  public void setAmountWithoutTax(BigDecimal amountWithoutTax) {
    this.amountWithoutTax = amountWithoutTax;
  }


  public ExpandedCreditMemoItem appliedToItemId(String appliedToItemId) {
    this.appliedToItemId = appliedToItemId;
    return this;
  }

  /**
   * Get appliedToItemId
   * @return appliedToItemId
   */
  @javax.annotation.Nullable
  public String getAppliedToItemId() {
    return appliedToItemId;
  }

  public void setAppliedToItemId(String appliedToItemId) {
    this.appliedToItemId = appliedToItemId;
  }


  public ExpandedCreditMemoItem appliedToOthersAmount(BigDecimal appliedToOthersAmount) {
    this.appliedToOthersAmount = appliedToOthersAmount;
    return this;
  }

  /**
   * Get appliedToOthersAmount
   * @return appliedToOthersAmount
   */
  @javax.annotation.Nullable
  public BigDecimal getAppliedToOthersAmount() {
    return appliedToOthersAmount;
  }

  public void setAppliedToOthersAmount(BigDecimal appliedToOthersAmount) {
    this.appliedToOthersAmount = appliedToOthersAmount;
  }


  public ExpandedCreditMemoItem beAppliedByOthersAmount(BigDecimal beAppliedByOthersAmount) {
    this.beAppliedByOthersAmount = beAppliedByOthersAmount;
    return this;
  }

  /**
   * Get beAppliedByOthersAmount
   * @return beAppliedByOthersAmount
   */
  @javax.annotation.Nullable
  public BigDecimal getBeAppliedByOthersAmount() {
    return beAppliedByOthersAmount;
  }

  public void setBeAppliedByOthersAmount(BigDecimal beAppliedByOthersAmount) {
    this.beAppliedByOthersAmount = beAppliedByOthersAmount;
  }


  public ExpandedCreditMemoItem chargeDate(String chargeDate) {
    this.chargeDate = chargeDate;
    return this;
  }

  /**
   * Get chargeDate
   * @return chargeDate
   */
  @javax.annotation.Nullable
  public String getChargeDate() {
    return chargeDate;
  }

  public void setChargeDate(String chargeDate) {
    this.chargeDate = chargeDate;
  }


  public ExpandedCreditMemoItem description(String description) {
    this.description = description;
    return this;
  }

  /**
   * Get description
   * @return description
   */
  @javax.annotation.Nullable
  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }


  public ExpandedCreditMemoItem excludeItemBillingFromRevenueAccounting(Boolean excludeItemBillingFromRevenueAccounting) {
    this.excludeItemBillingFromRevenueAccounting = excludeItemBillingFromRevenueAccounting;
    return this;
  }

  /**
   * Get excludeItemBillingFromRevenueAccounting
   * @return excludeItemBillingFromRevenueAccounting
   */
  @javax.annotation.Nullable
  public Boolean getExcludeItemBillingFromRevenueAccounting() {
    return excludeItemBillingFromRevenueAccounting;
  }

  public void setExcludeItemBillingFromRevenueAccounting(Boolean excludeItemBillingFromRevenueAccounting) {
    this.excludeItemBillingFromRevenueAccounting = excludeItemBillingFromRevenueAccounting;
  }


  public ExpandedCreditMemoItem fulfillmentId(String fulfillmentId) {
    this.fulfillmentId = fulfillmentId;
    return this;
  }

  /**
   * Get fulfillmentId
   * @return fulfillmentId
   */
  @javax.annotation.Nullable
  public String getFulfillmentId() {
    return fulfillmentId;
  }

  public void setFulfillmentId(String fulfillmentId) {
    this.fulfillmentId = fulfillmentId;
  }


  public ExpandedCreditMemoItem invoiceScheduleId(String invoiceScheduleId) {
    this.invoiceScheduleId = invoiceScheduleId;
    return this;
  }

  /**
   * Get invoiceScheduleId
   * @return invoiceScheduleId
   */
  @javax.annotation.Nullable
  public String getInvoiceScheduleId() {
    return invoiceScheduleId;
  }

  public void setInvoiceScheduleId(String invoiceScheduleId) {
    this.invoiceScheduleId = invoiceScheduleId;
  }


  public ExpandedCreditMemoItem invoiceScheduleItemId(String invoiceScheduleItemId) {
    this.invoiceScheduleItemId = invoiceScheduleItemId;
    return this;
  }

  /**
   * Get invoiceScheduleItemId
   * @return invoiceScheduleItemId
   */
  @javax.annotation.Nullable
  public String getInvoiceScheduleItemId() {
    return invoiceScheduleItemId;
  }

  public void setInvoiceScheduleItemId(String invoiceScheduleItemId) {
    this.invoiceScheduleItemId = invoiceScheduleItemId;
  }


  public ExpandedCreditMemoItem itemSoldToContactId(String itemSoldToContactId) {
    this.itemSoldToContactId = itemSoldToContactId;
    return this;
  }

  /**
   * Get itemSoldToContactId
   * @return itemSoldToContactId
   */
  @javax.annotation.Nullable
  public String getItemSoldToContactId() {
    return itemSoldToContactId;
  }

  public void setItemSoldToContactId(String itemSoldToContactId) {
    this.itemSoldToContactId = itemSoldToContactId;
  }


  public ExpandedCreditMemoItem itemSoldToContactSnapshotId(String itemSoldToContactSnapshotId) {
    this.itemSoldToContactSnapshotId = itemSoldToContactSnapshotId;
    return this;
  }

  /**
   * Get itemSoldToContactSnapshotId
   * @return itemSoldToContactSnapshotId
   */
  @javax.annotation.Nullable
  public String getItemSoldToContactSnapshotId() {
    return itemSoldToContactSnapshotId;
  }

  public void setItemSoldToContactSnapshotId(String itemSoldToContactSnapshotId) {
    this.itemSoldToContactSnapshotId = itemSoldToContactSnapshotId;
  }


  public ExpandedCreditMemoItem itemType(String itemType) {
    this.itemType = itemType;
    return this;
  }

  /**
   * Get itemType
   * @return itemType
   */
  @javax.annotation.Nullable
  public String getItemType() {
    return itemType;
  }

  public void setItemType(String itemType) {
    this.itemType = itemType;
  }


  public ExpandedCreditMemoItem orderLineItemId(String orderLineItemId) {
    this.orderLineItemId = orderLineItemId;
    return this;
  }

  /**
   * Get orderLineItemId
   * @return orderLineItemId
   */
  @javax.annotation.Nullable
  public String getOrderLineItemId() {
    return orderLineItemId;
  }

  public void setOrderLineItemId(String orderLineItemId) {
    this.orderLineItemId = orderLineItemId;
  }


  public ExpandedCreditMemoItem processingType(String processingType) {
    this.processingType = processingType;
    return this;
  }

  /**
   * Get processingType
   * @return processingType
   */
  @javax.annotation.Nullable
  public String getProcessingType() {
    return processingType;
  }

  public void setProcessingType(String processingType) {
    this.processingType = processingType;
  }


  public ExpandedCreditMemoItem purchaseOrderNumber(String purchaseOrderNumber) {
    this.purchaseOrderNumber = purchaseOrderNumber;
    return this;
  }

  /**
   * Get purchaseOrderNumber
   * @return purchaseOrderNumber
   */
  @javax.annotation.Nullable
  public String getPurchaseOrderNumber() {
    return purchaseOrderNumber;
  }

  public void setPurchaseOrderNumber(String purchaseOrderNumber) {
    this.purchaseOrderNumber = purchaseOrderNumber;
  }


  public ExpandedCreditMemoItem quantity(BigDecimal quantity) {
    this.quantity = quantity;
    return this;
  }

  /**
   * Get quantity
   * @return quantity
   */
  @javax.annotation.Nullable
  public BigDecimal getQuantity() {
    return quantity;
  }

  public void setQuantity(BigDecimal quantity) {
    this.quantity = quantity;
  }


  public ExpandedCreditMemoItem creditFromItemSource(String creditFromItemSource) {
    this.creditFromItemSource = creditFromItemSource;
    return this;
  }

  /**
   * Get creditFromItemSource
   * @return creditFromItemSource
   */
  @javax.annotation.Nullable
  public String getCreditFromItemSource() {
    return creditFromItemSource;
  }

  public void setCreditFromItemSource(String creditFromItemSource) {
    this.creditFromItemSource = creditFromItemSource;
  }


  public ExpandedCreditMemoItem creditFromItemId(String creditFromItemId) {
    this.creditFromItemId = creditFromItemId;
    return this;
  }

  /**
   * Get creditFromItemId
   * @return creditFromItemId
   */
  @javax.annotation.Nullable
  public String getCreditFromItemId() {
    return creditFromItemId;
  }

  public void setCreditFromItemId(String creditFromItemId) {
    this.creditFromItemId = creditFromItemId;
  }


  public ExpandedCreditMemoItem serviceEndDate(LocalDate serviceEndDate) {
    this.serviceEndDate = serviceEndDate;
    return this;
  }

  /**
   * Get serviceEndDate
   * @return serviceEndDate
   */
  @javax.annotation.Nullable
  public LocalDate getServiceEndDate() {
    return serviceEndDate;
  }

  public void setServiceEndDate(LocalDate serviceEndDate) {
    this.serviceEndDate = serviceEndDate;
  }


  public ExpandedCreditMemoItem serviceStartDate(LocalDate serviceStartDate) {
    this.serviceStartDate = serviceStartDate;
    return this;
  }

  /**
   * Get serviceStartDate
   * @return serviceStartDate
   */
  @javax.annotation.Nullable
  public LocalDate getServiceStartDate() {
    return serviceStartDate;
  }

  public void setServiceStartDate(LocalDate serviceStartDate) {
    this.serviceStartDate = serviceStartDate;
  }


  public ExpandedCreditMemoItem sku(String sku) {
    this.sku = sku;
    return this;
  }

  /**
   * Get sku
   * @return sku
   */
  @javax.annotation.Nullable
  public String getSku() {
    return sku;
  }

  public void setSku(String sku) {
    this.sku = sku;
  }


  public ExpandedCreditMemoItem sourceItemType(String sourceItemType) {
    this.sourceItemType = sourceItemType;
    return this;
  }

  /**
   * Get sourceItemType
   * @return sourceItemType
   */
  @javax.annotation.Nullable
  public String getSourceItemType() {
    return sourceItemType;
  }

  public void setSourceItemType(String sourceItemType) {
    this.sourceItemType = sourceItemType;
  }


  public ExpandedCreditMemoItem chargeName(String chargeName) {
    this.chargeName = chargeName;
    return this;
  }

  /**
   * Get chargeName
   * @return chargeName
   */
  @javax.annotation.Nullable
  public String getChargeName() {
    return chargeName;
  }

  public void setChargeName(String chargeName) {
    this.chargeName = chargeName;
  }


  public ExpandedCreditMemoItem chargeNumber(String chargeNumber) {
    this.chargeNumber = chargeNumber;
    return this;
  }

  /**
   * Get chargeNumber
   * @return chargeNumber
   */
  @javax.annotation.Nullable
  public String getChargeNumber() {
    return chargeNumber;
  }

  public void setChargeNumber(String chargeNumber) {
    this.chargeNumber = chargeNumber;
  }


  public ExpandedCreditMemoItem commitmentChargeSegmentNumber(String commitmentChargeSegmentNumber) {
    this.commitmentChargeSegmentNumber = commitmentChargeSegmentNumber;
    return this;
  }

  /**
   * Get commitmentChargeSegmentNumber
   * @return commitmentChargeSegmentNumber
   */
  @javax.annotation.Nullable
  public String getCommitmentChargeSegmentNumber() {
    return commitmentChargeSegmentNumber;
  }

  public void setCommitmentChargeSegmentNumber(String commitmentChargeSegmentNumber) {
    this.commitmentChargeSegmentNumber = commitmentChargeSegmentNumber;
  }


  public ExpandedCreditMemoItem commitmentChargeNumber(String commitmentChargeNumber) {
    this.commitmentChargeNumber = commitmentChargeNumber;
    return this;
  }

  /**
   * Get commitmentChargeNumber
   * @return commitmentChargeNumber
   */
  @javax.annotation.Nullable
  public String getCommitmentChargeNumber() {
    return commitmentChargeNumber;
  }

  public void setCommitmentChargeNumber(String commitmentChargeNumber) {
    this.commitmentChargeNumber = commitmentChargeNumber;
  }


  public ExpandedCreditMemoItem taxAmount(BigDecimal taxAmount) {
    this.taxAmount = taxAmount;
    return this;
  }

  /**
   * Get taxAmount
   * @return taxAmount
   */
  @javax.annotation.Nullable
  public BigDecimal getTaxAmount() {
    return taxAmount;
  }

  public void setTaxAmount(BigDecimal taxAmount) {
    this.taxAmount = taxAmount;
  }


  public ExpandedCreditMemoItem taxCodeName(String taxCodeName) {
    this.taxCodeName = taxCodeName;
    return this;
  }

  /**
   * Get taxCodeName
   * @return taxCodeName
   */
  @javax.annotation.Nullable
  public String getTaxCodeName() {
    return taxCodeName;
  }

  public void setTaxCodeName(String taxCodeName) {
    this.taxCodeName = taxCodeName;
  }


  public ExpandedCreditMemoItem taxExemptAmount(BigDecimal taxExemptAmount) {
    this.taxExemptAmount = taxExemptAmount;
    return this;
  }

  /**
   * Get taxExemptAmount
   * @return taxExemptAmount
   */
  @javax.annotation.Nullable
  public BigDecimal getTaxExemptAmount() {
    return taxExemptAmount;
  }

  public void setTaxExemptAmount(BigDecimal taxExemptAmount) {
    this.taxExemptAmount = taxExemptAmount;
  }


  public ExpandedCreditMemoItem taxMode(String taxMode) {
    this.taxMode = taxMode;
    return this;
  }

  /**
   * Get taxMode
   * @return taxMode
   */
  @javax.annotation.Nullable
  public String getTaxMode() {
    return taxMode;
  }

  public void setTaxMode(String taxMode) {
    this.taxMode = taxMode;
  }


  public ExpandedCreditMemoItem unitOfMeasure(String unitOfMeasure) {
    this.unitOfMeasure = unitOfMeasure;
    return this;
  }

  /**
   * Get unitOfMeasure
   * @return unitOfMeasure
   */
  @javax.annotation.Nullable
  public String getUnitOfMeasure() {
    return unitOfMeasure;
  }

  public void setUnitOfMeasure(String unitOfMeasure) {
    this.unitOfMeasure = unitOfMeasure;
  }


  public ExpandedCreditMemoItem unitPrice(BigDecimal unitPrice) {
    this.unitPrice = unitPrice;
    return this;
  }

  /**
   * Get unitPrice
   * @return unitPrice
   */
  @javax.annotation.Nullable
  public BigDecimal getUnitPrice() {
    return unitPrice;
  }

  public void setUnitPrice(BigDecimal unitPrice) {
    this.unitPrice = unitPrice;
  }


  public ExpandedCreditMemoItem unappliedAmount(BigDecimal unappliedAmount) {
    this.unappliedAmount = unappliedAmount;
    return this;
  }

  /**
   * Get unappliedAmount
   * @return unappliedAmount
   */
  @javax.annotation.Nullable
  public BigDecimal getUnappliedAmount() {
    return unappliedAmount;
  }

  public void setUnappliedAmount(BigDecimal unappliedAmount) {
    this.unappliedAmount = unappliedAmount;
  }


  public ExpandedCreditMemoItem subscriptionId(String subscriptionId) {
    this.subscriptionId = subscriptionId;
    return this;
  }

  /**
   * Get subscriptionId
   * @return subscriptionId
   */
  @javax.annotation.Nullable
  public String getSubscriptionId() {
    return subscriptionId;
  }

  public void setSubscriptionId(String subscriptionId) {
    this.subscriptionId = subscriptionId;
  }


  public ExpandedCreditMemoItem subscriptionNumber(String subscriptionNumber) {
    this.subscriptionNumber = subscriptionNumber;
    return this;
  }

  /**
   * Get subscriptionNumber
   * @return subscriptionNumber
   */
  @javax.annotation.Nullable
  public String getSubscriptionNumber() {
    return subscriptionNumber;
  }

  public void setSubscriptionNumber(String subscriptionNumber) {
    this.subscriptionNumber = subscriptionNumber;
  }


  public ExpandedCreditMemoItem invoiceItemId(String invoiceItemId) {
    this.invoiceItemId = invoiceItemId;
    return this;
  }

  /**
   * Get invoiceItemId
   * @return invoiceItemId
   */
  @javax.annotation.Nullable
  public String getInvoiceItemId() {
    return invoiceItemId;
  }

  public void setInvoiceItemId(String invoiceItemId) {
    this.invoiceItemId = invoiceItemId;
  }


  public ExpandedCreditMemoItem productRatePlanChargeId(String productRatePlanChargeId) {
    this.productRatePlanChargeId = productRatePlanChargeId;
    return this;
  }

  /**
   * Get productRatePlanChargeId
   * @return productRatePlanChargeId
   */
  @javax.annotation.Nullable
  public String getProductRatePlanChargeId() {
    return productRatePlanChargeId;
  }

  public void setProductRatePlanChargeId(String productRatePlanChargeId) {
    this.productRatePlanChargeId = productRatePlanChargeId;
  }


  public ExpandedCreditMemoItem ratePlanChargeId(String ratePlanChargeId) {
    this.ratePlanChargeId = ratePlanChargeId;
    return this;
  }

  /**
   * Get ratePlanChargeId
   * @return ratePlanChargeId
   */
  @javax.annotation.Nullable
  public String getRatePlanChargeId() {
    return ratePlanChargeId;
  }

  public void setRatePlanChargeId(String ratePlanChargeId) {
    this.ratePlanChargeId = ratePlanChargeId;
  }


  public ExpandedCreditMemoItem revenueRecognitionRuleName(String revenueRecognitionRuleName) {
    this.revenueRecognitionRuleName = revenueRecognitionRuleName;
    return this;
  }

  /**
   * Get revenueRecognitionRuleName
   * @return revenueRecognitionRuleName
   */
  @javax.annotation.Nullable
  public String getRevenueRecognitionRuleName() {
    return revenueRecognitionRuleName;
  }

  public void setRevenueRecognitionRuleName(String revenueRecognitionRuleName) {
    this.revenueRecognitionRuleName = revenueRecognitionRuleName;
  }


  public ExpandedCreditMemoItem creditMemoId(String creditMemoId) {
    this.creditMemoId = creditMemoId;
    return this;
  }

  /**
   * Get creditMemoId
   * @return creditMemoId
   */
  @javax.annotation.Nullable
  public String getCreditMemoId() {
    return creditMemoId;
  }

  public void setCreditMemoId(String creditMemoId) {
    this.creditMemoId = creditMemoId;
  }


  public ExpandedCreditMemoItem numberOfDeliveries(BigDecimal numberOfDeliveries) {
    this.numberOfDeliveries = numberOfDeliveries;
    return this;
  }

  /**
   * Get numberOfDeliveries
   * @return numberOfDeliveries
   */
  @javax.annotation.Nullable
  public BigDecimal getNumberOfDeliveries() {
    return numberOfDeliveries;
  }

  public void setNumberOfDeliveries(BigDecimal numberOfDeliveries) {
    this.numberOfDeliveries = numberOfDeliveries;
  }


  public ExpandedCreditMemoItem reflectDiscountInNetAmount(Boolean reflectDiscountInNetAmount) {
    this.reflectDiscountInNetAmount = reflectDiscountInNetAmount;
    return this;
  }

  /**
   * Get reflectDiscountInNetAmount
   * @return reflectDiscountInNetAmount
   */
  @javax.annotation.Nullable
  public Boolean getReflectDiscountInNetAmount() {
    return reflectDiscountInNetAmount;
  }

  public void setReflectDiscountInNetAmount(Boolean reflectDiscountInNetAmount) {
    this.reflectDiscountInNetAmount = reflectDiscountInNetAmount;
  }


  public ExpandedCreditMemoItem id(String id) {
    this.id = id;
    return this;
  }

  /**
   * Get id
   * @return id
   */
  @javax.annotation.Nullable
  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }


  public ExpandedCreditMemoItem createdById(String createdById) {
    this.createdById = createdById;
    return this;
  }

  /**
   * Get createdById
   * @return createdById
   */
  @javax.annotation.Nullable
  public String getCreatedById() {
    return createdById;
  }

  public void setCreatedById(String createdById) {
    this.createdById = createdById;
  }


  public ExpandedCreditMemoItem createdDate(String createdDate) {
    this.createdDate = createdDate;
    return this;
  }

  /**
   * Get createdDate
   * @return createdDate
   */
  @javax.annotation.Nullable
  public String getCreatedDate() {
    return createdDate;
  }

  public void setCreatedDate(String createdDate) {
    this.createdDate = createdDate;
  }


  public ExpandedCreditMemoItem updatedById(String updatedById) {
    this.updatedById = updatedById;
    return this;
  }

  /**
   * Get updatedById
   * @return updatedById
   */
  @javax.annotation.Nullable
  public String getUpdatedById() {
    return updatedById;
  }

  public void setUpdatedById(String updatedById) {
    this.updatedById = updatedById;
  }


  public ExpandedCreditMemoItem updatedDate(String updatedDate) {
    this.updatedDate = updatedDate;
    return this;
  }

  /**
   * Get updatedDate
   * @return updatedDate
   */
  @javax.annotation.Nullable
  public String getUpdatedDate() {
    return updatedDate;
  }

  public void setUpdatedDate(String updatedDate) {
    this.updatedDate = updatedDate;
  }


  public ExpandedCreditMemoItem recognizedRevenueAccountingCodeId(String recognizedRevenueAccountingCodeId) {
    this.recognizedRevenueAccountingCodeId = recognizedRevenueAccountingCodeId;
    return this;
  }

  /**
   * Get recognizedRevenueAccountingCodeId
   * @return recognizedRevenueAccountingCodeId
   */
  @javax.annotation.Nullable
  public String getRecognizedRevenueAccountingCodeId() {
    return recognizedRevenueAccountingCodeId;
  }

  public void setRecognizedRevenueAccountingCodeId(String recognizedRevenueAccountingCodeId) {
    this.recognizedRevenueAccountingCodeId = recognizedRevenueAccountingCodeId;
  }


  public ExpandedCreditMemoItem accountReceivableAccountingCodeId(String accountReceivableAccountingCodeId) {
    this.accountReceivableAccountingCodeId = accountReceivableAccountingCodeId;
    return this;
  }

  /**
   * Get accountReceivableAccountingCodeId
   * @return accountReceivableAccountingCodeId
   */
  @javax.annotation.Nullable
  public String getAccountReceivableAccountingCodeId() {
    return accountReceivableAccountingCodeId;
  }

  public void setAccountReceivableAccountingCodeId(String accountReceivableAccountingCodeId) {
    this.accountReceivableAccountingCodeId = accountReceivableAccountingCodeId;
  }


  public ExpandedCreditMemoItem onAccountAccountingCodeId(String onAccountAccountingCodeId) {
    this.onAccountAccountingCodeId = onAccountAccountingCodeId;
    return this;
  }

  /**
   * Get onAccountAccountingCodeId
   * @return onAccountAccountingCodeId
   */
  @javax.annotation.Nullable
  public String getOnAccountAccountingCodeId() {
    return onAccountAccountingCodeId;
  }

  public void setOnAccountAccountingCodeId(String onAccountAccountingCodeId) {
    this.onAccountAccountingCodeId = onAccountAccountingCodeId;
  }


  public ExpandedCreditMemoItem deferredRevenueAccountingCodeId(String deferredRevenueAccountingCodeId) {
    this.deferredRevenueAccountingCodeId = deferredRevenueAccountingCodeId;
    return this;
  }

  /**
   * Get deferredRevenueAccountingCodeId
   * @return deferredRevenueAccountingCodeId
   */
  @javax.annotation.Nullable
  public String getDeferredRevenueAccountingCodeId() {
    return deferredRevenueAccountingCodeId;
  }

  public void setDeferredRevenueAccountingCodeId(String deferredRevenueAccountingCodeId) {
    this.deferredRevenueAccountingCodeId = deferredRevenueAccountingCodeId;
  }


  public ExpandedCreditMemoItem nonRevenueWriteOffAccountingCodeId(String nonRevenueWriteOffAccountingCodeId) {
    this.nonRevenueWriteOffAccountingCodeId = nonRevenueWriteOffAccountingCodeId;
    return this;
  }

  /**
   * Get nonRevenueWriteOffAccountingCodeId
   * @return nonRevenueWriteOffAccountingCodeId
   */
  @javax.annotation.Nullable
  public String getNonRevenueWriteOffAccountingCodeId() {
    return nonRevenueWriteOffAccountingCodeId;
  }

  public void setNonRevenueWriteOffAccountingCodeId(String nonRevenueWriteOffAccountingCodeId) {
    this.nonRevenueWriteOffAccountingCodeId = nonRevenueWriteOffAccountingCodeId;
  }


  public ExpandedCreditMemoItem journalEntryId(String journalEntryId) {
    this.journalEntryId = journalEntryId;
    return this;
  }

  /**
   * Get journalEntryId
   * @return journalEntryId
   */
  @javax.annotation.Nullable
  public String getJournalEntryId() {
    return journalEntryId;
  }

  public void setJournalEntryId(String journalEntryId) {
    this.journalEntryId = journalEntryId;
  }


  public ExpandedCreditMemoItem soldToContactSnapshotId(String soldToContactSnapshotId) {
    this.soldToContactSnapshotId = soldToContactSnapshotId;
    return this;
  }

  /**
   * Get soldToContactSnapshotId
   * @return soldToContactSnapshotId
   */
  @javax.annotation.Nullable
  public String getSoldToContactSnapshotId() {
    return soldToContactSnapshotId;
  }

  public void setSoldToContactSnapshotId(String soldToContactSnapshotId) {
    this.soldToContactSnapshotId = soldToContactSnapshotId;
  }


  public ExpandedCreditMemoItem billToContactSnapshotId(String billToContactSnapshotId) {
    this.billToContactSnapshotId = billToContactSnapshotId;
    return this;
  }

  /**
   * Get billToContactSnapshotId
   * @return billToContactSnapshotId
   */
  @javax.annotation.Nullable
  public String getBillToContactSnapshotId() {
    return billToContactSnapshotId;
  }

  public void setBillToContactSnapshotId(String billToContactSnapshotId) {
    this.billToContactSnapshotId = billToContactSnapshotId;
  }


  public ExpandedCreditMemoItem debitMemoItemId(String debitMemoItemId) {
    this.debitMemoItemId = debitMemoItemId;
    return this;
  }

  /**
   * Get debitMemoItemId
   * @return debitMemoItemId
   */
  @javax.annotation.Nullable
  public String getDebitMemoItemId() {
    return debitMemoItemId;
  }

  public void setDebitMemoItemId(String debitMemoItemId) {
    this.debitMemoItemId = debitMemoItemId;
  }


  public ExpandedCreditMemoItem subscription(ExpandedSubscription subscription) {
    this.subscription = subscription;
    return this;
  }

  /**
   * Get subscription
   * @return subscription
   */
  @javax.annotation.Nullable
  public ExpandedSubscription getSubscription() {
    return subscription;
  }

  public void setSubscription(ExpandedSubscription subscription) {
    this.subscription = subscription;
  }


  public ExpandedCreditMemoItem ratePlanCharge(ExpandedRatePlanCharge ratePlanCharge) {
    this.ratePlanCharge = ratePlanCharge;
    return this;
  }

  /**
   * Get ratePlanCharge
   * @return ratePlanCharge
   */
  @javax.annotation.Nullable
  public ExpandedRatePlanCharge getRatePlanCharge() {
    return ratePlanCharge;
  }

  public void setRatePlanCharge(ExpandedRatePlanCharge ratePlanCharge) {
    this.ratePlanCharge = ratePlanCharge;
  }

  /**
   * A container for additional, undeclared properties.
   * This is a holder for any undeclared properties as specified with
   * the 'additionalProperties' keyword in the OAS document.
   */
  private Map additionalProperties;

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   *
   * @param key name of the property
   * @param value value of the property
   * @return the ExpandedCreditMemoItem instance itself
   */
  public ExpandedCreditMemoItem putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Return the additional (undeclared) property.
   *
   * @return a map of objects
   */
  public Map getAdditionalProperties() {
    return additionalProperties;
  }

  /**
   * Return the additional (undeclared) property with the specified name.
   *
   * @param key name of the property
   * @return an object
   */
  public Object getAdditionalProperty(String key) {
    if (this.additionalProperties == null) {
        return null;
    }
    return this.additionalProperties.get(key);
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ExpandedCreditMemoItem expandedCreditMemoItem = (ExpandedCreditMemoItem) o;
    return Objects.equals(this.amount, expandedCreditMemoItem.amount) &&
        Objects.equals(this.amountWithoutTax, expandedCreditMemoItem.amountWithoutTax) &&
        Objects.equals(this.appliedToItemId, expandedCreditMemoItem.appliedToItemId) &&
        Objects.equals(this.appliedToOthersAmount, expandedCreditMemoItem.appliedToOthersAmount) &&
        Objects.equals(this.beAppliedByOthersAmount, expandedCreditMemoItem.beAppliedByOthersAmount) &&
        Objects.equals(this.chargeDate, expandedCreditMemoItem.chargeDate) &&
        Objects.equals(this.description, expandedCreditMemoItem.description) &&
        Objects.equals(this.excludeItemBillingFromRevenueAccounting, expandedCreditMemoItem.excludeItemBillingFromRevenueAccounting) &&
        Objects.equals(this.fulfillmentId, expandedCreditMemoItem.fulfillmentId) &&
        Objects.equals(this.invoiceScheduleId, expandedCreditMemoItem.invoiceScheduleId) &&
        Objects.equals(this.invoiceScheduleItemId, expandedCreditMemoItem.invoiceScheduleItemId) &&
        Objects.equals(this.itemSoldToContactId, expandedCreditMemoItem.itemSoldToContactId) &&
        Objects.equals(this.itemSoldToContactSnapshotId, expandedCreditMemoItem.itemSoldToContactSnapshotId) &&
        Objects.equals(this.itemType, expandedCreditMemoItem.itemType) &&
        Objects.equals(this.orderLineItemId, expandedCreditMemoItem.orderLineItemId) &&
        Objects.equals(this.processingType, expandedCreditMemoItem.processingType) &&
        Objects.equals(this.purchaseOrderNumber, expandedCreditMemoItem.purchaseOrderNumber) &&
        Objects.equals(this.quantity, expandedCreditMemoItem.quantity) &&
        Objects.equals(this.creditFromItemSource, expandedCreditMemoItem.creditFromItemSource) &&
        Objects.equals(this.creditFromItemId, expandedCreditMemoItem.creditFromItemId) &&
        Objects.equals(this.serviceEndDate, expandedCreditMemoItem.serviceEndDate) &&
        Objects.equals(this.serviceStartDate, expandedCreditMemoItem.serviceStartDate) &&
        Objects.equals(this.sku, expandedCreditMemoItem.sku) &&
        Objects.equals(this.sourceItemType, expandedCreditMemoItem.sourceItemType) &&
        Objects.equals(this.chargeName, expandedCreditMemoItem.chargeName) &&
        Objects.equals(this.chargeNumber, expandedCreditMemoItem.chargeNumber) &&
        Objects.equals(this.commitmentChargeSegmentNumber, expandedCreditMemoItem.commitmentChargeSegmentNumber) &&
        Objects.equals(this.commitmentChargeNumber, expandedCreditMemoItem.commitmentChargeNumber) &&
        Objects.equals(this.taxAmount, expandedCreditMemoItem.taxAmount) &&
        Objects.equals(this.taxCodeName, expandedCreditMemoItem.taxCodeName) &&
        Objects.equals(this.taxExemptAmount, expandedCreditMemoItem.taxExemptAmount) &&
        Objects.equals(this.taxMode, expandedCreditMemoItem.taxMode) &&
        Objects.equals(this.unitOfMeasure, expandedCreditMemoItem.unitOfMeasure) &&
        Objects.equals(this.unitPrice, expandedCreditMemoItem.unitPrice) &&
        Objects.equals(this.unappliedAmount, expandedCreditMemoItem.unappliedAmount) &&
        Objects.equals(this.subscriptionId, expandedCreditMemoItem.subscriptionId) &&
        Objects.equals(this.subscriptionNumber, expandedCreditMemoItem.subscriptionNumber) &&
        Objects.equals(this.invoiceItemId, expandedCreditMemoItem.invoiceItemId) &&
        Objects.equals(this.productRatePlanChargeId, expandedCreditMemoItem.productRatePlanChargeId) &&
        Objects.equals(this.ratePlanChargeId, expandedCreditMemoItem.ratePlanChargeId) &&
        Objects.equals(this.revenueRecognitionRuleName, expandedCreditMemoItem.revenueRecognitionRuleName) &&
        Objects.equals(this.creditMemoId, expandedCreditMemoItem.creditMemoId) &&
        Objects.equals(this.numberOfDeliveries, expandedCreditMemoItem.numberOfDeliveries) &&
        Objects.equals(this.reflectDiscountInNetAmount, expandedCreditMemoItem.reflectDiscountInNetAmount) &&
        Objects.equals(this.id, expandedCreditMemoItem.id) &&
        Objects.equals(this.createdById, expandedCreditMemoItem.createdById) &&
        Objects.equals(this.createdDate, expandedCreditMemoItem.createdDate) &&
        Objects.equals(this.updatedById, expandedCreditMemoItem.updatedById) &&
        Objects.equals(this.updatedDate, expandedCreditMemoItem.updatedDate) &&
        Objects.equals(this.recognizedRevenueAccountingCodeId, expandedCreditMemoItem.recognizedRevenueAccountingCodeId) &&
        Objects.equals(this.accountReceivableAccountingCodeId, expandedCreditMemoItem.accountReceivableAccountingCodeId) &&
        Objects.equals(this.onAccountAccountingCodeId, expandedCreditMemoItem.onAccountAccountingCodeId) &&
        Objects.equals(this.deferredRevenueAccountingCodeId, expandedCreditMemoItem.deferredRevenueAccountingCodeId) &&
        Objects.equals(this.nonRevenueWriteOffAccountingCodeId, expandedCreditMemoItem.nonRevenueWriteOffAccountingCodeId) &&
        Objects.equals(this.journalEntryId, expandedCreditMemoItem.journalEntryId) &&
        Objects.equals(this.soldToContactSnapshotId, expandedCreditMemoItem.soldToContactSnapshotId) &&
        Objects.equals(this.billToContactSnapshotId, expandedCreditMemoItem.billToContactSnapshotId) &&
        Objects.equals(this.debitMemoItemId, expandedCreditMemoItem.debitMemoItemId) &&
        Objects.equals(this.subscription, expandedCreditMemoItem.subscription) &&
        Objects.equals(this.ratePlanCharge, expandedCreditMemoItem.ratePlanCharge)&&
        Objects.equals(this.additionalProperties, expandedCreditMemoItem.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(amount, amountWithoutTax, appliedToItemId, appliedToOthersAmount, beAppliedByOthersAmount, chargeDate, description, excludeItemBillingFromRevenueAccounting, fulfillmentId, invoiceScheduleId, invoiceScheduleItemId, itemSoldToContactId, itemSoldToContactSnapshotId, itemType, orderLineItemId, processingType, purchaseOrderNumber, quantity, creditFromItemSource, creditFromItemId, serviceEndDate, serviceStartDate, sku, sourceItemType, chargeName, chargeNumber, commitmentChargeSegmentNumber, commitmentChargeNumber, taxAmount, taxCodeName, taxExemptAmount, taxMode, unitOfMeasure, unitPrice, unappliedAmount, subscriptionId, subscriptionNumber, invoiceItemId, productRatePlanChargeId, ratePlanChargeId, revenueRecognitionRuleName, creditMemoId, numberOfDeliveries, reflectDiscountInNetAmount, id, createdById, createdDate, updatedById, updatedDate, recognizedRevenueAccountingCodeId, accountReceivableAccountingCodeId, onAccountAccountingCodeId, deferredRevenueAccountingCodeId, nonRevenueWriteOffAccountingCodeId, journalEntryId, soldToContactSnapshotId, billToContactSnapshotId, debitMemoItemId, subscription, ratePlanCharge, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ExpandedCreditMemoItem {\n");
    sb.append("    amount: ").append(toIndentedString(amount)).append("\n");
    sb.append("    amountWithoutTax: ").append(toIndentedString(amountWithoutTax)).append("\n");
    sb.append("    appliedToItemId: ").append(toIndentedString(appliedToItemId)).append("\n");
    sb.append("    appliedToOthersAmount: ").append(toIndentedString(appliedToOthersAmount)).append("\n");
    sb.append("    beAppliedByOthersAmount: ").append(toIndentedString(beAppliedByOthersAmount)).append("\n");
    sb.append("    chargeDate: ").append(toIndentedString(chargeDate)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    excludeItemBillingFromRevenueAccounting: ").append(toIndentedString(excludeItemBillingFromRevenueAccounting)).append("\n");
    sb.append("    fulfillmentId: ").append(toIndentedString(fulfillmentId)).append("\n");
    sb.append("    invoiceScheduleId: ").append(toIndentedString(invoiceScheduleId)).append("\n");
    sb.append("    invoiceScheduleItemId: ").append(toIndentedString(invoiceScheduleItemId)).append("\n");
    sb.append("    itemSoldToContactId: ").append(toIndentedString(itemSoldToContactId)).append("\n");
    sb.append("    itemSoldToContactSnapshotId: ").append(toIndentedString(itemSoldToContactSnapshotId)).append("\n");
    sb.append("    itemType: ").append(toIndentedString(itemType)).append("\n");
    sb.append("    orderLineItemId: ").append(toIndentedString(orderLineItemId)).append("\n");
    sb.append("    processingType: ").append(toIndentedString(processingType)).append("\n");
    sb.append("    purchaseOrderNumber: ").append(toIndentedString(purchaseOrderNumber)).append("\n");
    sb.append("    quantity: ").append(toIndentedString(quantity)).append("\n");
    sb.append("    creditFromItemSource: ").append(toIndentedString(creditFromItemSource)).append("\n");
    sb.append("    creditFromItemId: ").append(toIndentedString(creditFromItemId)).append("\n");
    sb.append("    serviceEndDate: ").append(toIndentedString(serviceEndDate)).append("\n");
    sb.append("    serviceStartDate: ").append(toIndentedString(serviceStartDate)).append("\n");
    sb.append("    sku: ").append(toIndentedString(sku)).append("\n");
    sb.append("    sourceItemType: ").append(toIndentedString(sourceItemType)).append("\n");
    sb.append("    chargeName: ").append(toIndentedString(chargeName)).append("\n");
    sb.append("    chargeNumber: ").append(toIndentedString(chargeNumber)).append("\n");
    sb.append("    commitmentChargeSegmentNumber: ").append(toIndentedString(commitmentChargeSegmentNumber)).append("\n");
    sb.append("    commitmentChargeNumber: ").append(toIndentedString(commitmentChargeNumber)).append("\n");
    sb.append("    taxAmount: ").append(toIndentedString(taxAmount)).append("\n");
    sb.append("    taxCodeName: ").append(toIndentedString(taxCodeName)).append("\n");
    sb.append("    taxExemptAmount: ").append(toIndentedString(taxExemptAmount)).append("\n");
    sb.append("    taxMode: ").append(toIndentedString(taxMode)).append("\n");
    sb.append("    unitOfMeasure: ").append(toIndentedString(unitOfMeasure)).append("\n");
    sb.append("    unitPrice: ").append(toIndentedString(unitPrice)).append("\n");
    sb.append("    unappliedAmount: ").append(toIndentedString(unappliedAmount)).append("\n");
    sb.append("    subscriptionId: ").append(toIndentedString(subscriptionId)).append("\n");
    sb.append("    subscriptionNumber: ").append(toIndentedString(subscriptionNumber)).append("\n");
    sb.append("    invoiceItemId: ").append(toIndentedString(invoiceItemId)).append("\n");
    sb.append("    productRatePlanChargeId: ").append(toIndentedString(productRatePlanChargeId)).append("\n");
    sb.append("    ratePlanChargeId: ").append(toIndentedString(ratePlanChargeId)).append("\n");
    sb.append("    revenueRecognitionRuleName: ").append(toIndentedString(revenueRecognitionRuleName)).append("\n");
    sb.append("    creditMemoId: ").append(toIndentedString(creditMemoId)).append("\n");
    sb.append("    numberOfDeliveries: ").append(toIndentedString(numberOfDeliveries)).append("\n");
    sb.append("    reflectDiscountInNetAmount: ").append(toIndentedString(reflectDiscountInNetAmount)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    createdById: ").append(toIndentedString(createdById)).append("\n");
    sb.append("    createdDate: ").append(toIndentedString(createdDate)).append("\n");
    sb.append("    updatedById: ").append(toIndentedString(updatedById)).append("\n");
    sb.append("    updatedDate: ").append(toIndentedString(updatedDate)).append("\n");
    sb.append("    recognizedRevenueAccountingCodeId: ").append(toIndentedString(recognizedRevenueAccountingCodeId)).append("\n");
    sb.append("    accountReceivableAccountingCodeId: ").append(toIndentedString(accountReceivableAccountingCodeId)).append("\n");
    sb.append("    onAccountAccountingCodeId: ").append(toIndentedString(onAccountAccountingCodeId)).append("\n");
    sb.append("    deferredRevenueAccountingCodeId: ").append(toIndentedString(deferredRevenueAccountingCodeId)).append("\n");
    sb.append("    nonRevenueWriteOffAccountingCodeId: ").append(toIndentedString(nonRevenueWriteOffAccountingCodeId)).append("\n");
    sb.append("    journalEntryId: ").append(toIndentedString(journalEntryId)).append("\n");
    sb.append("    soldToContactSnapshotId: ").append(toIndentedString(soldToContactSnapshotId)).append("\n");
    sb.append("    billToContactSnapshotId: ").append(toIndentedString(billToContactSnapshotId)).append("\n");
    sb.append("    debitMemoItemId: ").append(toIndentedString(debitMemoItemId)).append("\n");
    sb.append("    subscription: ").append(toIndentedString(subscription)).append("\n");
    sb.append("    ratePlanCharge: ").append(toIndentedString(ratePlanCharge)).append("\n");
    sb.append("    additionalProperties: ").append(toIndentedString(additionalProperties)).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 openapiFields;
  public static HashSet openapiRequiredFields;

  static {
    // a set of all properties/fields (JSON key names)
    openapiFields = new HashSet();
    openapiFields.add("amount");
    openapiFields.add("amountWithoutTax");
    openapiFields.add("appliedToItemId");
    openapiFields.add("appliedToOthersAmount");
    openapiFields.add("beAppliedByOthersAmount");
    openapiFields.add("chargeDate");
    openapiFields.add("description");
    openapiFields.add("excludeItemBillingFromRevenueAccounting");
    openapiFields.add("fulfillmentId");
    openapiFields.add("invoiceScheduleId");
    openapiFields.add("invoiceScheduleItemId");
    openapiFields.add("itemSoldToContactId");
    openapiFields.add("itemSoldToContactSnapshotId");
    openapiFields.add("itemType");
    openapiFields.add("orderLineItemId");
    openapiFields.add("processingType");
    openapiFields.add("purchaseOrderNumber");
    openapiFields.add("quantity");
    openapiFields.add("creditFromItemSource");
    openapiFields.add("creditFromItemId");
    openapiFields.add("serviceEndDate");
    openapiFields.add("serviceStartDate");
    openapiFields.add("sku");
    openapiFields.add("sourceItemType");
    openapiFields.add("chargeName");
    openapiFields.add("chargeNumber");
    openapiFields.add("commitmentChargeSegmentNumber");
    openapiFields.add("commitmentChargeNumber");
    openapiFields.add("taxAmount");
    openapiFields.add("taxCodeName");
    openapiFields.add("taxExemptAmount");
    openapiFields.add("taxMode");
    openapiFields.add("unitOfMeasure");
    openapiFields.add("unitPrice");
    openapiFields.add("unappliedAmount");
    openapiFields.add("subscriptionId");
    openapiFields.add("subscriptionNumber");
    openapiFields.add("invoiceItemId");
    openapiFields.add("productRatePlanChargeId");
    openapiFields.add("ratePlanChargeId");
    openapiFields.add("revenueRecognitionRuleName");
    openapiFields.add("creditMemoId");
    openapiFields.add("numberOfDeliveries");
    openapiFields.add("reflectDiscountInNetAmount");
    openapiFields.add("id");
    openapiFields.add("createdById");
    openapiFields.add("createdDate");
    openapiFields.add("updatedById");
    openapiFields.add("updatedDate");
    openapiFields.add("recognizedRevenueAccountingCodeId");
    openapiFields.add("accountReceivableAccountingCodeId");
    openapiFields.add("onAccountAccountingCodeId");
    openapiFields.add("deferredRevenueAccountingCodeId");
    openapiFields.add("nonRevenueWriteOffAccountingCodeId");
    openapiFields.add("journalEntryId");
    openapiFields.add("soldToContactSnapshotId");
    openapiFields.add("billToContactSnapshotId");
    openapiFields.add("debitMemoItemId");
    openapiFields.add("subscription");
    openapiFields.add("ratePlanCharge");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet();
  }

  /**
   * 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 ExpandedCreditMemoItem
   */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!ExpandedCreditMemoItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in ExpandedCreditMemoItem is not found in the empty JSON string", ExpandedCreditMemoItem.openapiRequiredFields.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
      if ((jsonObj.get("appliedToItemId") != null && !jsonObj.get("appliedToItemId").isJsonNull()) && !jsonObj.get("appliedToItemId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `appliedToItemId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("appliedToItemId").toString()));
      }
      if ((jsonObj.get("chargeDate") != null && !jsonObj.get("chargeDate").isJsonNull()) && !jsonObj.get("chargeDate").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `chargeDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("chargeDate").toString()));
      }
      if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
      }
      if ((jsonObj.get("fulfillmentId") != null && !jsonObj.get("fulfillmentId").isJsonNull()) && !jsonObj.get("fulfillmentId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `fulfillmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fulfillmentId").toString()));
      }
      if ((jsonObj.get("invoiceScheduleId") != null && !jsonObj.get("invoiceScheduleId").isJsonNull()) && !jsonObj.get("invoiceScheduleId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoiceScheduleId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoiceScheduleId").toString()));
      }
      if ((jsonObj.get("invoiceScheduleItemId") != null && !jsonObj.get("invoiceScheduleItemId").isJsonNull()) && !jsonObj.get("invoiceScheduleItemId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoiceScheduleItemId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoiceScheduleItemId").toString()));
      }
      if ((jsonObj.get("itemSoldToContactId") != null && !jsonObj.get("itemSoldToContactId").isJsonNull()) && !jsonObj.get("itemSoldToContactId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `itemSoldToContactId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("itemSoldToContactId").toString()));
      }
      if ((jsonObj.get("itemSoldToContactSnapshotId") != null && !jsonObj.get("itemSoldToContactSnapshotId").isJsonNull()) && !jsonObj.get("itemSoldToContactSnapshotId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `itemSoldToContactSnapshotId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("itemSoldToContactSnapshotId").toString()));
      }
      if ((jsonObj.get("itemType") != null && !jsonObj.get("itemType").isJsonNull()) && !jsonObj.get("itemType").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `itemType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("itemType").toString()));
      }
      if ((jsonObj.get("orderLineItemId") != null && !jsonObj.get("orderLineItemId").isJsonNull()) && !jsonObj.get("orderLineItemId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `orderLineItemId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orderLineItemId").toString()));
      }
      if ((jsonObj.get("processingType") != null && !jsonObj.get("processingType").isJsonNull()) && !jsonObj.get("processingType").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `processingType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("processingType").toString()));
      }
      if ((jsonObj.get("purchaseOrderNumber") != null && !jsonObj.get("purchaseOrderNumber").isJsonNull()) && !jsonObj.get("purchaseOrderNumber").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `purchaseOrderNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("purchaseOrderNumber").toString()));
      }
      if ((jsonObj.get("creditFromItemSource") != null && !jsonObj.get("creditFromItemSource").isJsonNull()) && !jsonObj.get("creditFromItemSource").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `creditFromItemSource` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creditFromItemSource").toString()));
      }
      if ((jsonObj.get("creditFromItemId") != null && !jsonObj.get("creditFromItemId").isJsonNull()) && !jsonObj.get("creditFromItemId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `creditFromItemId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creditFromItemId").toString()));
      }
      if ((jsonObj.get("sku") != null && !jsonObj.get("sku").isJsonNull()) && !jsonObj.get("sku").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `sku` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sku").toString()));
      }
      if ((jsonObj.get("sourceItemType") != null && !jsonObj.get("sourceItemType").isJsonNull()) && !jsonObj.get("sourceItemType").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `sourceItemType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceItemType").toString()));
      }
      if ((jsonObj.get("chargeName") != null && !jsonObj.get("chargeName").isJsonNull()) && !jsonObj.get("chargeName").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `chargeName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("chargeName").toString()));
      }
      if ((jsonObj.get("chargeNumber") != null && !jsonObj.get("chargeNumber").isJsonNull()) && !jsonObj.get("chargeNumber").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `chargeNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("chargeNumber").toString()));
      }
      if ((jsonObj.get("commitmentChargeSegmentNumber") != null && !jsonObj.get("commitmentChargeSegmentNumber").isJsonNull()) && !jsonObj.get("commitmentChargeSegmentNumber").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `commitmentChargeSegmentNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commitmentChargeSegmentNumber").toString()));
      }
      if ((jsonObj.get("commitmentChargeNumber") != null && !jsonObj.get("commitmentChargeNumber").isJsonNull()) && !jsonObj.get("commitmentChargeNumber").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `commitmentChargeNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commitmentChargeNumber").toString()));
      }
      if ((jsonObj.get("taxCodeName") != null && !jsonObj.get("taxCodeName").isJsonNull()) && !jsonObj.get("taxCodeName").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `taxCodeName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxCodeName").toString()));
      }
      if ((jsonObj.get("taxMode") != null && !jsonObj.get("taxMode").isJsonNull()) && !jsonObj.get("taxMode").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `taxMode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taxMode").toString()));
      }
      if ((jsonObj.get("unitOfMeasure") != null && !jsonObj.get("unitOfMeasure").isJsonNull()) && !jsonObj.get("unitOfMeasure").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `unitOfMeasure` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unitOfMeasure").toString()));
      }
      if ((jsonObj.get("subscriptionId") != null && !jsonObj.get("subscriptionId").isJsonNull()) && !jsonObj.get("subscriptionId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `subscriptionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subscriptionId").toString()));
      }
      if ((jsonObj.get("subscriptionNumber") != null && !jsonObj.get("subscriptionNumber").isJsonNull()) && !jsonObj.get("subscriptionNumber").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `subscriptionNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subscriptionNumber").toString()));
      }
      if ((jsonObj.get("invoiceItemId") != null && !jsonObj.get("invoiceItemId").isJsonNull()) && !jsonObj.get("invoiceItemId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `invoiceItemId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invoiceItemId").toString()));
      }
      if ((jsonObj.get("productRatePlanChargeId") != null && !jsonObj.get("productRatePlanChargeId").isJsonNull()) && !jsonObj.get("productRatePlanChargeId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `productRatePlanChargeId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productRatePlanChargeId").toString()));
      }
      if ((jsonObj.get("ratePlanChargeId") != null && !jsonObj.get("ratePlanChargeId").isJsonNull()) && !jsonObj.get("ratePlanChargeId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `ratePlanChargeId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ratePlanChargeId").toString()));
      }
      if ((jsonObj.get("revenueRecognitionRuleName") != null && !jsonObj.get("revenueRecognitionRuleName").isJsonNull()) && !jsonObj.get("revenueRecognitionRuleName").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `revenueRecognitionRuleName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("revenueRecognitionRuleName").toString()));
      }
      if ((jsonObj.get("creditMemoId") != null && !jsonObj.get("creditMemoId").isJsonNull()) && !jsonObj.get("creditMemoId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `creditMemoId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creditMemoId").toString()));
      }
      if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
      }
      if ((jsonObj.get("createdById") != null && !jsonObj.get("createdById").isJsonNull()) && !jsonObj.get("createdById").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `createdById` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdById").toString()));
      }
      if ((jsonObj.get("createdDate") != null && !jsonObj.get("createdDate").isJsonNull()) && !jsonObj.get("createdDate").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `createdDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdDate").toString()));
      }
      if ((jsonObj.get("updatedById") != null && !jsonObj.get("updatedById").isJsonNull()) && !jsonObj.get("updatedById").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `updatedById` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedById").toString()));
      }
      if ((jsonObj.get("updatedDate") != null && !jsonObj.get("updatedDate").isJsonNull()) && !jsonObj.get("updatedDate").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `updatedDate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updatedDate").toString()));
      }
      if ((jsonObj.get("recognizedRevenueAccountingCodeId") != null && !jsonObj.get("recognizedRevenueAccountingCodeId").isJsonNull()) && !jsonObj.get("recognizedRevenueAccountingCodeId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `recognizedRevenueAccountingCodeId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recognizedRevenueAccountingCodeId").toString()));
      }
      if ((jsonObj.get("accountReceivableAccountingCodeId") != null && !jsonObj.get("accountReceivableAccountingCodeId").isJsonNull()) && !jsonObj.get("accountReceivableAccountingCodeId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `accountReceivableAccountingCodeId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountReceivableAccountingCodeId").toString()));
      }
      if ((jsonObj.get("onAccountAccountingCodeId") != null && !jsonObj.get("onAccountAccountingCodeId").isJsonNull()) && !jsonObj.get("onAccountAccountingCodeId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `onAccountAccountingCodeId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("onAccountAccountingCodeId").toString()));
      }
      if ((jsonObj.get("deferredRevenueAccountingCodeId") != null && !jsonObj.get("deferredRevenueAccountingCodeId").isJsonNull()) && !jsonObj.get("deferredRevenueAccountingCodeId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `deferredRevenueAccountingCodeId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deferredRevenueAccountingCodeId").toString()));
      }
      if ((jsonObj.get("nonRevenueWriteOffAccountingCodeId") != null && !jsonObj.get("nonRevenueWriteOffAccountingCodeId").isJsonNull()) && !jsonObj.get("nonRevenueWriteOffAccountingCodeId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `nonRevenueWriteOffAccountingCodeId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nonRevenueWriteOffAccountingCodeId").toString()));
      }
      if ((jsonObj.get("journalEntryId") != null && !jsonObj.get("journalEntryId").isJsonNull()) && !jsonObj.get("journalEntryId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `journalEntryId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("journalEntryId").toString()));
      }
      if ((jsonObj.get("soldToContactSnapshotId") != null && !jsonObj.get("soldToContactSnapshotId").isJsonNull()) && !jsonObj.get("soldToContactSnapshotId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `soldToContactSnapshotId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("soldToContactSnapshotId").toString()));
      }
      if ((jsonObj.get("billToContactSnapshotId") != null && !jsonObj.get("billToContactSnapshotId").isJsonNull()) && !jsonObj.get("billToContactSnapshotId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `billToContactSnapshotId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("billToContactSnapshotId").toString()));
      }
      if ((jsonObj.get("debitMemoItemId") != null && !jsonObj.get("debitMemoItemId").isJsonNull()) && !jsonObj.get("debitMemoItemId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `debitMemoItemId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("debitMemoItemId").toString()));
      }
  }

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

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, ExpandedCreditMemoItem value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             obj.remove("additionalProperties");

             // support null values
             out.beginObject();
             Iterator iterator = obj.entrySet().iterator();
             while(iterator.hasNext()) {
                 Map.Entry e = (Map.Entry) iterator.next();
                 out.name((String)e.getKey());
                 elementAdapter.write(out, e.getValue());
             }

             // end

             // serialize additional properties
             if (value.getAdditionalProperties() != null) {
               // support null values
               boolean oldSerializeNulls = out.getSerializeNulls();
               out.setSerializeNulls(true); //force serialize
               // end
               for (Map.Entry entry : value.getAdditionalProperties().entrySet()) {
                 if (entry.getValue() instanceof String)
                   obj.addProperty(entry.getKey(), (String) entry.getValue());
                 else if (entry.getValue() instanceof Number)
                   obj.addProperty(entry.getKey(), (Number) entry.getValue());
                 else if (entry.getValue() instanceof Boolean)
                   obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
                 else if (entry.getValue() instanceof Character)
                   obj.addProperty(entry.getKey(), (Character) entry.getValue());
                 else if (entry.getValue() == null)
                    obj.add(entry.getKey(), null);
                 else {
                   JsonElement jsonElement = gson.toJsonTree(entry.getValue());
                   if (jsonElement.isJsonArray()) {
                     obj.add(entry.getKey(), jsonElement.getAsJsonArray());
                   } else {
                     obj.add(entry.getKey(), jsonElement.getAsJsonObject());
                   }
                 }
                 out.name((String)entry.getKey());
                 elementAdapter.write(out, obj.get(entry.getKey()));
               }
               out.setSerializeNulls(oldSerializeNulls); //restore
             }
             out.endObject();

           }

           @Override
           public ExpandedCreditMemoItem read(JsonReader in) throws IOException {
             JsonElement jsonElement = elementAdapter.read(in);
             validateJsonElement(jsonElement);
             JsonObject jsonObj = jsonElement.getAsJsonObject();
             // store additional fields in the deserialized instance
             ExpandedCreditMemoItem instance = thisAdapter.fromJsonTree(jsonObj);
             for (Map.Entry entry : jsonObj.entrySet()) {
               if (!openapiFields.contains(entry.getKey())) {
                 if (entry.getValue().isJsonPrimitive()) { // primitive type
                   if (entry.getValue().getAsJsonPrimitive().isString())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
                   else if (entry.getValue().getAsJsonPrimitive().isNumber())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
                   else if (entry.getValue().getAsJsonPrimitive().isBoolean())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
                   else
                     throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
                 } else if (entry.getValue().isJsonArray()) {
                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
                 } else { // JSON object
                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
                 }
               }
             }
             return instance;
           }

       }.nullSafe();
    }
  }

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

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





© 2015 - 2025 Weber Informatics LLC | Privacy Policy