001
002package com.commercetools.api.models.me;
003
004import java.time.*;
005import java.util.*;
006
007import com.fasterxml.jackson.annotation.JsonCreator;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import com.fasterxml.jackson.databind.annotation.*;
010
011import io.vrap.rmf.base.client.ModelBase;
012import io.vrap.rmf.base.client.utils.Generated;
013
014import org.apache.commons.lang3.builder.EqualsBuilder;
015import org.apache.commons.lang3.builder.HashCodeBuilder;
016
017/**
018 *  <p>The <code>customerId</code> is determined by a password flow token and automatically set on the resulting Cart. The <code>anonymousId</code> is determined by a token for an anonymous session and automatically set on the resulting Cart.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class MyCartDraftImpl implements MyCartDraft, ModelBase {
022
023    private String currency;
024
025    private String customerEmail;
026
027    private com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifier businessUnit;
028
029    private com.commercetools.api.models.store.StoreResourceIdentifier store;
030
031    private java.util.List<com.commercetools.api.models.me.MyLineItemDraft> lineItems;
032
033    private com.commercetools.api.models.cart.TaxMode taxMode;
034
035    private com.commercetools.api.models.cart.InventoryMode inventoryMode;
036
037    private com.commercetools.api.models.common.BaseAddress billingAddress;
038
039    private com.commercetools.api.models.common.BaseAddress shippingAddress;
040
041    private com.commercetools.api.models.shipping_method.ShippingMethodResourceIdentifier shippingMethod;
042
043    private java.util.List<com.commercetools.api.models.common.BaseAddress> itemShippingAddresses;
044
045    private java.util.List<String> discountCodes;
046
047    private String country;
048
049    private String locale;
050
051    private Long deleteDaysAfterLastModification;
052
053    private com.commercetools.api.models.type.CustomFieldsDraft custom;
054
055    /**
056     * create instance with all properties
057     */
058    @JsonCreator
059    MyCartDraftImpl(@JsonProperty("currency") final String currency,
060            @JsonProperty("customerEmail") final String customerEmail,
061            @JsonProperty("businessUnit") final com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifier businessUnit,
062            @JsonProperty("store") final com.commercetools.api.models.store.StoreResourceIdentifier store,
063            @JsonProperty("lineItems") final java.util.List<com.commercetools.api.models.me.MyLineItemDraft> lineItems,
064            @JsonProperty("taxMode") final com.commercetools.api.models.cart.TaxMode taxMode,
065            @JsonProperty("inventoryMode") final com.commercetools.api.models.cart.InventoryMode inventoryMode,
066            @JsonProperty("billingAddress") final com.commercetools.api.models.common.BaseAddress billingAddress,
067            @JsonProperty("shippingAddress") final com.commercetools.api.models.common.BaseAddress shippingAddress,
068            @JsonProperty("shippingMethod") final com.commercetools.api.models.shipping_method.ShippingMethodResourceIdentifier shippingMethod,
069            @JsonProperty("itemShippingAddresses") final java.util.List<com.commercetools.api.models.common.BaseAddress> itemShippingAddresses,
070            @JsonProperty("discountCodes") final java.util.List<String> discountCodes,
071            @JsonProperty("country") final String country, @JsonProperty("locale") final String locale,
072            @JsonProperty("deleteDaysAfterLastModification") final Long deleteDaysAfterLastModification,
073            @JsonProperty("custom") final com.commercetools.api.models.type.CustomFieldsDraft custom) {
074        this.currency = currency;
075        this.customerEmail = customerEmail;
076        this.businessUnit = businessUnit;
077        this.store = store;
078        this.lineItems = lineItems;
079        this.taxMode = taxMode;
080        this.inventoryMode = inventoryMode;
081        this.billingAddress = billingAddress;
082        this.shippingAddress = shippingAddress;
083        this.shippingMethod = shippingMethod;
084        this.itemShippingAddresses = itemShippingAddresses;
085        this.discountCodes = discountCodes;
086        this.country = country;
087        this.locale = locale;
088        this.deleteDaysAfterLastModification = deleteDaysAfterLastModification;
089        this.custom = custom;
090    }
091
092    /**
093     * create empty instance
094     */
095    public MyCartDraftImpl() {
096    }
097
098    /**
099     *  <p>Currency the Cart uses.</p>
100     */
101
102    public String getCurrency() {
103        return this.currency;
104    }
105
106    /**
107     *  <p>Email address of the Customer the Cart belongs to.</p>
108     */
109
110    public String getCustomerEmail() {
111        return this.customerEmail;
112    }
113
114    /**
115     *  <p>ResourceIdentifier to the Business Unit the Cart should belong to. The Customer must be an Associate of the Business Unit.</p>
116     */
117
118    public com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifier getBusinessUnit() {
119        return this.businessUnit;
120    }
121
122    /**
123     *  <p>ResourceIdentifier to the Store the Cart should belong to. Once set, it cannot be updated.</p>
124     */
125
126    public com.commercetools.api.models.store.StoreResourceIdentifier getStore() {
127        return this.store;
128    }
129
130    /**
131     *  <p>Line Items to add to the Cart.</p>
132     */
133
134    public java.util.List<com.commercetools.api.models.me.MyLineItemDraft> getLineItems() {
135        return this.lineItems;
136    }
137
138    /**
139     *  <p>Determines how Tax Rates are set. The <code>Disabled</code> TaxMode <strong>cannot</strong> be set.</p>
140     */
141
142    public com.commercetools.api.models.cart.TaxMode getTaxMode() {
143        return this.taxMode;
144    }
145
146    /**
147     *  <p>Determines how stock quantities are tracked for Line Items in the Cart.</p>
148     */
149
150    public com.commercetools.api.models.cart.InventoryMode getInventoryMode() {
151        return this.inventoryMode;
152    }
153
154    /**
155     *  <p>Billing address associated with the Cart.</p>
156     */
157
158    public com.commercetools.api.models.common.BaseAddress getBillingAddress() {
159        return this.billingAddress;
160    }
161
162    /**
163     *  <p>Shipping address associated with the Cart. Determines eligible ShippingMethod rates and Tax Rates of Line Items.</p>
164     */
165
166    public com.commercetools.api.models.common.BaseAddress getShippingAddress() {
167        return this.shippingAddress;
168    }
169
170    /**
171     *  <p>Shipping Method for the Cart. If the referenced ShippingMethod has a <code>predicate</code> that does not match the Cart, an InvalidOperation error is returned when creating a Cart.</p>
172     */
173
174    public com.commercetools.api.models.shipping_method.ShippingMethodResourceIdentifier getShippingMethod() {
175        return this.shippingMethod;
176    }
177
178    /**
179     *  <p>Multiple shipping addresses of the Cart. Each address must contain a <code>key</code> that is unique in this Cart. The keys are used by LineItems to reference these addresses under their <code>shippingDetails</code>.</p>
180     *  <p>Eligible Shipping Methods or applicable Tax Rates are determined by the Cart <code>shippingAddress</code>, and not <code>itemShippingAddresses</code>.</p>
181     */
182
183    public java.util.List<com.commercetools.api.models.common.BaseAddress> getItemShippingAddresses() {
184        return this.itemShippingAddresses;
185    }
186
187    /**
188     *  <p><code>code</code> of the existing DiscountCodes to add to the Cart.</p>
189     */
190
191    public java.util.List<String> getDiscountCodes() {
192        return this.discountCodes;
193    }
194
195    /**
196     *  <p>Used for LineItem Price selection. If used for Create Cart in Store, the provided country must be one of the Store's <code>countries</code>.</p>
197     */
198
199    public String getCountry() {
200        return this.country;
201    }
202
203    /**
204     *  <p>Languages of the Cart. Can only contain languages supported by the Project.</p>
205     */
206
207    public String getLocale() {
208        return this.locale;
209    }
210
211    /**
212     *  <p>Number of days after which a Cart with <code>Active</code> CartState is deleted since its last modification. If not provided, the default value for this field configured in Project settings is assigned.</p>
213     *  <p>Create a ChangeSubscription for Carts to receive a ResourceDeletedDeliveryPayload upon deletion of the Cart.</p>
214     */
215
216    public Long getDeleteDaysAfterLastModification() {
217        return this.deleteDaysAfterLastModification;
218    }
219
220    /**
221     *  <p>Custom Fields for the Cart.</p>
222     */
223
224    public com.commercetools.api.models.type.CustomFieldsDraft getCustom() {
225        return this.custom;
226    }
227
228    public void setCurrency(final String currency) {
229        this.currency = currency;
230    }
231
232    public void setCustomerEmail(final String customerEmail) {
233        this.customerEmail = customerEmail;
234    }
235
236    public void setBusinessUnit(
237            final com.commercetools.api.models.business_unit.BusinessUnitResourceIdentifier businessUnit) {
238        this.businessUnit = businessUnit;
239    }
240
241    public void setStore(final com.commercetools.api.models.store.StoreResourceIdentifier store) {
242        this.store = store;
243    }
244
245    public void setLineItems(final com.commercetools.api.models.me.MyLineItemDraft... lineItems) {
246        this.lineItems = new ArrayList<>(Arrays.asList(lineItems));
247    }
248
249    public void setLineItems(final java.util.List<com.commercetools.api.models.me.MyLineItemDraft> lineItems) {
250        this.lineItems = lineItems;
251    }
252
253    public void setTaxMode(final com.commercetools.api.models.cart.TaxMode taxMode) {
254        this.taxMode = taxMode;
255    }
256
257    public void setInventoryMode(final com.commercetools.api.models.cart.InventoryMode inventoryMode) {
258        this.inventoryMode = inventoryMode;
259    }
260
261    public void setBillingAddress(final com.commercetools.api.models.common.BaseAddress billingAddress) {
262        this.billingAddress = billingAddress;
263    }
264
265    public void setShippingAddress(final com.commercetools.api.models.common.BaseAddress shippingAddress) {
266        this.shippingAddress = shippingAddress;
267    }
268
269    public void setShippingMethod(
270            final com.commercetools.api.models.shipping_method.ShippingMethodResourceIdentifier shippingMethod) {
271        this.shippingMethod = shippingMethod;
272    }
273
274    public void setItemShippingAddresses(
275            final com.commercetools.api.models.common.BaseAddress... itemShippingAddresses) {
276        this.itemShippingAddresses = new ArrayList<>(Arrays.asList(itemShippingAddresses));
277    }
278
279    public void setItemShippingAddresses(
280            final java.util.List<com.commercetools.api.models.common.BaseAddress> itemShippingAddresses) {
281        this.itemShippingAddresses = itemShippingAddresses;
282    }
283
284    public void setDiscountCodes(final String... discountCodes) {
285        this.discountCodes = new ArrayList<>(Arrays.asList(discountCodes));
286    }
287
288    public void setDiscountCodes(final java.util.List<String> discountCodes) {
289        this.discountCodes = discountCodes;
290    }
291
292    public void setCountry(final String country) {
293        this.country = country;
294    }
295
296    public void setLocale(final String locale) {
297        this.locale = locale;
298    }
299
300    public void setDeleteDaysAfterLastModification(final Long deleteDaysAfterLastModification) {
301        this.deleteDaysAfterLastModification = deleteDaysAfterLastModification;
302    }
303
304    public void setCustom(final com.commercetools.api.models.type.CustomFieldsDraft custom) {
305        this.custom = custom;
306    }
307
308    @Override
309    public boolean equals(Object o) {
310        if (this == o)
311            return true;
312
313        if (o == null || getClass() != o.getClass())
314            return false;
315
316        MyCartDraftImpl that = (MyCartDraftImpl) o;
317
318        return new EqualsBuilder().append(currency, that.currency)
319                .append(customerEmail, that.customerEmail)
320                .append(businessUnit, that.businessUnit)
321                .append(store, that.store)
322                .append(lineItems, that.lineItems)
323                .append(taxMode, that.taxMode)
324                .append(inventoryMode, that.inventoryMode)
325                .append(billingAddress, that.billingAddress)
326                .append(shippingAddress, that.shippingAddress)
327                .append(shippingMethod, that.shippingMethod)
328                .append(itemShippingAddresses, that.itemShippingAddresses)
329                .append(discountCodes, that.discountCodes)
330                .append(country, that.country)
331                .append(locale, that.locale)
332                .append(deleteDaysAfterLastModification, that.deleteDaysAfterLastModification)
333                .append(custom, that.custom)
334                .isEquals();
335    }
336
337    @Override
338    public int hashCode() {
339        return new HashCodeBuilder(17, 37).append(currency)
340                .append(customerEmail)
341                .append(businessUnit)
342                .append(store)
343                .append(lineItems)
344                .append(taxMode)
345                .append(inventoryMode)
346                .append(billingAddress)
347                .append(shippingAddress)
348                .append(shippingMethod)
349                .append(itemShippingAddresses)
350                .append(discountCodes)
351                .append(country)
352                .append(locale)
353                .append(deleteDaysAfterLastModification)
354                .append(custom)
355                .toHashCode();
356    }
357
358}