001
002package com.commercetools.api.models.me;
003
004import java.util.*;
005import java.util.function.Function;
006
007import javax.annotation.Nullable;
008
009import io.vrap.rmf.base.client.Builder;
010import io.vrap.rmf.base.client.utils.Generated;
011
012/**
013 * MyCartAddLineItemActionBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     MyCartAddLineItemAction myCartAddLineItemAction = MyCartAddLineItemAction.builder()
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class MyCartAddLineItemActionBuilder implements Builder<MyCartAddLineItemAction> {
025
026    @Nullable
027    private String key;
028
029    @Nullable
030    private String productId;
031
032    @Nullable
033    private Long variantId;
034
035    @Nullable
036    private String sku;
037
038    @Nullable
039    private Long quantity;
040
041    @Nullable
042    private java.time.ZonedDateTime addedAt;
043
044    @Nullable
045    private com.commercetools.api.models.channel.ChannelResourceIdentifier distributionChannel;
046
047    @Nullable
048    private com.commercetools.api.models.channel.ChannelResourceIdentifier supplyChannel;
049
050    @Nullable
051    private com.commercetools.api.models.cart.ItemShippingDetailsDraft shippingDetails;
052
053    @Nullable
054    private com.commercetools.api.models.type.CustomFieldsDraft custom;
055
056    /**
057     *  <p>User-defined unique identifier of the LineItem.</p>
058     * @param key value to be set
059     * @return Builder
060     */
061
062    public MyCartAddLineItemActionBuilder key(@Nullable final String key) {
063        this.key = key;
064        return this;
065    }
066
067    /**
068     *  <p><code>id</code> of the Product.</p>
069     *  <p>Either the <code>productId</code> and <code>variantId</code>, or <code>sku</code> must be provided.</p>
070     * @param productId value to be set
071     * @return Builder
072     */
073
074    public MyCartAddLineItemActionBuilder productId(@Nullable final String productId) {
075        this.productId = productId;
076        return this;
077    }
078
079    /**
080     *  <p><code>id</code> of the ProductVariant in the Product.</p>
081     *  <p>If not given, the Master Variant is used.</p>
082     *  <p>Either the <code>productId</code> and <code>variantId</code>, or <code>sku</code> must be provided.</p>
083     * @param variantId value to be set
084     * @return Builder
085     */
086
087    public MyCartAddLineItemActionBuilder variantId(@Nullable final Long variantId) {
088        this.variantId = variantId;
089        return this;
090    }
091
092    /**
093     *  <p><code>sku</code> of the ProductVariant.</p>
094     *  <p>Either the <code>productId</code> and <code>variantId</code>, or <code>sku</code> must be provided.</p>
095     * @param sku value to be set
096     * @return Builder
097     */
098
099    public MyCartAddLineItemActionBuilder sku(@Nullable final String sku) {
100        this.sku = sku;
101        return this;
102    }
103
104    /**
105     *  <p>Number of Line Items to add to the Cart.</p>
106     * @param quantity value to be set
107     * @return Builder
108     */
109
110    public MyCartAddLineItemActionBuilder quantity(@Nullable final Long quantity) {
111        this.quantity = quantity;
112        return this;
113    }
114
115    /**
116     *  <p>Date and time (UTC) the Line Item was added to the Cart. If not set, it defaults to the current date and time.</p>
117     *  <p>Optional for backwards compatibility reasons.</p>
118     * @param addedAt value to be set
119     * @return Builder
120     */
121
122    public MyCartAddLineItemActionBuilder addedAt(@Nullable final java.time.ZonedDateTime addedAt) {
123        this.addedAt = addedAt;
124        return this;
125    }
126
127    /**
128     *  <p>Used to select a Product Price. The Channel must have the <code>ProductDistribution</code> ChannelRoleEnum. If the Cart is bound to a Store with <code>distributionChannels</code> set, the Channel must match one of the Store's distribution channels.</p>
129     * @param builder function to build the distributionChannel value
130     * @return Builder
131     */
132
133    public MyCartAddLineItemActionBuilder distributionChannel(
134            Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder> builder) {
135        this.distributionChannel = builder
136                .apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of())
137                .build();
138        return this;
139    }
140
141    /**
142     *  <p>Used to select a Product Price. The Channel must have the <code>ProductDistribution</code> ChannelRoleEnum. If the Cart is bound to a Store with <code>distributionChannels</code> set, the Channel must match one of the Store's distribution channels.</p>
143     * @param builder function to build the distributionChannel value
144     * @return Builder
145     */
146
147    public MyCartAddLineItemActionBuilder withDistributionChannel(
148            Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifier> builder) {
149        this.distributionChannel = builder
150                .apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of());
151        return this;
152    }
153
154    /**
155     *  <p>Used to select a Product Price. The Channel must have the <code>ProductDistribution</code> ChannelRoleEnum. If the Cart is bound to a Store with <code>distributionChannels</code> set, the Channel must match one of the Store's distribution channels.</p>
156     * @param distributionChannel value to be set
157     * @return Builder
158     */
159
160    public MyCartAddLineItemActionBuilder distributionChannel(
161            @Nullable final com.commercetools.api.models.channel.ChannelResourceIdentifier distributionChannel) {
162        this.distributionChannel = distributionChannel;
163        return this;
164    }
165
166    /**
167     *  <p>Used to identify Inventory entries that must be reserved. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</p>
168     * @param builder function to build the supplyChannel value
169     * @return Builder
170     */
171
172    public MyCartAddLineItemActionBuilder supplyChannel(
173            Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder> builder) {
174        this.supplyChannel = builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of())
175                .build();
176        return this;
177    }
178
179    /**
180     *  <p>Used to identify Inventory entries that must be reserved. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</p>
181     * @param builder function to build the supplyChannel value
182     * @return Builder
183     */
184
185    public MyCartAddLineItemActionBuilder withSupplyChannel(
186            Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifier> builder) {
187        this.supplyChannel = builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of());
188        return this;
189    }
190
191    /**
192     *  <p>Used to identify Inventory entries that must be reserved. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</p>
193     * @param supplyChannel value to be set
194     * @return Builder
195     */
196
197    public MyCartAddLineItemActionBuilder supplyChannel(
198            @Nullable final com.commercetools.api.models.channel.ChannelResourceIdentifier supplyChannel) {
199        this.supplyChannel = supplyChannel;
200        return this;
201    }
202
203    /**
204     *  <p>Container for Line Item-specific addresses.</p>
205     * @param builder function to build the shippingDetails value
206     * @return Builder
207     */
208
209    public MyCartAddLineItemActionBuilder shippingDetails(
210            Function<com.commercetools.api.models.cart.ItemShippingDetailsDraftBuilder, com.commercetools.api.models.cart.ItemShippingDetailsDraftBuilder> builder) {
211        this.shippingDetails = builder.apply(com.commercetools.api.models.cart.ItemShippingDetailsDraftBuilder.of())
212                .build();
213        return this;
214    }
215
216    /**
217     *  <p>Container for Line Item-specific addresses.</p>
218     * @param builder function to build the shippingDetails value
219     * @return Builder
220     */
221
222    public MyCartAddLineItemActionBuilder withShippingDetails(
223            Function<com.commercetools.api.models.cart.ItemShippingDetailsDraftBuilder, com.commercetools.api.models.cart.ItemShippingDetailsDraft> builder) {
224        this.shippingDetails = builder.apply(com.commercetools.api.models.cart.ItemShippingDetailsDraftBuilder.of());
225        return this;
226    }
227
228    /**
229     *  <p>Container for Line Item-specific addresses.</p>
230     * @param shippingDetails value to be set
231     * @return Builder
232     */
233
234    public MyCartAddLineItemActionBuilder shippingDetails(
235            @Nullable final com.commercetools.api.models.cart.ItemShippingDetailsDraft shippingDetails) {
236        this.shippingDetails = shippingDetails;
237        return this;
238    }
239
240    /**
241     *  <p>Custom Fields for the Line Item.</p>
242     * @param builder function to build the custom value
243     * @return Builder
244     */
245
246    public MyCartAddLineItemActionBuilder custom(
247            Function<com.commercetools.api.models.type.CustomFieldsDraftBuilder, com.commercetools.api.models.type.CustomFieldsDraftBuilder> builder) {
248        this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsDraftBuilder.of()).build();
249        return this;
250    }
251
252    /**
253     *  <p>Custom Fields for the Line Item.</p>
254     * @param builder function to build the custom value
255     * @return Builder
256     */
257
258    public MyCartAddLineItemActionBuilder withCustom(
259            Function<com.commercetools.api.models.type.CustomFieldsDraftBuilder, com.commercetools.api.models.type.CustomFieldsDraft> builder) {
260        this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsDraftBuilder.of());
261        return this;
262    }
263
264    /**
265     *  <p>Custom Fields for the Line Item.</p>
266     * @param custom value to be set
267     * @return Builder
268     */
269
270    public MyCartAddLineItemActionBuilder custom(
271            @Nullable final com.commercetools.api.models.type.CustomFieldsDraft custom) {
272        this.custom = custom;
273        return this;
274    }
275
276    /**
277     *  <p>User-defined unique identifier of the LineItem.</p>
278     * @return key
279     */
280
281    @Nullable
282    public String getKey() {
283        return this.key;
284    }
285
286    /**
287     *  <p><code>id</code> of the Product.</p>
288     *  <p>Either the <code>productId</code> and <code>variantId</code>, or <code>sku</code> must be provided.</p>
289     * @return productId
290     */
291
292    @Nullable
293    public String getProductId() {
294        return this.productId;
295    }
296
297    /**
298     *  <p><code>id</code> of the ProductVariant in the Product.</p>
299     *  <p>If not given, the Master Variant is used.</p>
300     *  <p>Either the <code>productId</code> and <code>variantId</code>, or <code>sku</code> must be provided.</p>
301     * @return variantId
302     */
303
304    @Nullable
305    public Long getVariantId() {
306        return this.variantId;
307    }
308
309    /**
310     *  <p><code>sku</code> of the ProductVariant.</p>
311     *  <p>Either the <code>productId</code> and <code>variantId</code>, or <code>sku</code> must be provided.</p>
312     * @return sku
313     */
314
315    @Nullable
316    public String getSku() {
317        return this.sku;
318    }
319
320    /**
321     *  <p>Number of Line Items to add to the Cart.</p>
322     * @return quantity
323     */
324
325    @Nullable
326    public Long getQuantity() {
327        return this.quantity;
328    }
329
330    /**
331     *  <p>Date and time (UTC) the Line Item was added to the Cart. If not set, it defaults to the current date and time.</p>
332     *  <p>Optional for backwards compatibility reasons.</p>
333     * @return addedAt
334     */
335
336    @Nullable
337    public java.time.ZonedDateTime getAddedAt() {
338        return this.addedAt;
339    }
340
341    /**
342     *  <p>Used to select a Product Price. The Channel must have the <code>ProductDistribution</code> ChannelRoleEnum. If the Cart is bound to a Store with <code>distributionChannels</code> set, the Channel must match one of the Store's distribution channels.</p>
343     * @return distributionChannel
344     */
345
346    @Nullable
347    public com.commercetools.api.models.channel.ChannelResourceIdentifier getDistributionChannel() {
348        return this.distributionChannel;
349    }
350
351    /**
352     *  <p>Used to identify Inventory entries that must be reserved. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</p>
353     * @return supplyChannel
354     */
355
356    @Nullable
357    public com.commercetools.api.models.channel.ChannelResourceIdentifier getSupplyChannel() {
358        return this.supplyChannel;
359    }
360
361    /**
362     *  <p>Container for Line Item-specific addresses.</p>
363     * @return shippingDetails
364     */
365
366    @Nullable
367    public com.commercetools.api.models.cart.ItemShippingDetailsDraft getShippingDetails() {
368        return this.shippingDetails;
369    }
370
371    /**
372     *  <p>Custom Fields for the Line Item.</p>
373     * @return custom
374     */
375
376    @Nullable
377    public com.commercetools.api.models.type.CustomFieldsDraft getCustom() {
378        return this.custom;
379    }
380
381    /**
382     * builds MyCartAddLineItemAction with checking for non-null required values
383     * @return MyCartAddLineItemAction
384     */
385    public MyCartAddLineItemAction build() {
386        return new MyCartAddLineItemActionImpl(key, productId, variantId, sku, quantity, addedAt, distributionChannel,
387            supplyChannel, shippingDetails, custom);
388    }
389
390    /**
391     * builds MyCartAddLineItemAction without checking for non-null required values
392     * @return MyCartAddLineItemAction
393     */
394    public MyCartAddLineItemAction buildUnchecked() {
395        return new MyCartAddLineItemActionImpl(key, productId, variantId, sku, quantity, addedAt, distributionChannel,
396            supplyChannel, shippingDetails, custom);
397    }
398
399    /**
400     * factory method for an instance of MyCartAddLineItemActionBuilder
401     * @return builder
402     */
403    public static MyCartAddLineItemActionBuilder of() {
404        return new MyCartAddLineItemActionBuilder();
405    }
406
407    /**
408     * create builder for MyCartAddLineItemAction instance
409     * @param template instance with prefilled values for the builder
410     * @return builder
411     */
412    public static MyCartAddLineItemActionBuilder of(final MyCartAddLineItemAction template) {
413        MyCartAddLineItemActionBuilder builder = new MyCartAddLineItemActionBuilder();
414        builder.key = template.getKey();
415        builder.productId = template.getProductId();
416        builder.variantId = template.getVariantId();
417        builder.sku = template.getSku();
418        builder.quantity = template.getQuantity();
419        builder.addedAt = template.getAddedAt();
420        builder.distributionChannel = template.getDistributionChannel();
421        builder.supplyChannel = template.getSupplyChannel();
422        builder.shippingDetails = template.getShippingDetails();
423        builder.custom = template.getCustom();
424        return builder;
425    }
426
427}