001
002package com.commercetools.api.models.order;
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 * ProductVariantImportDraftBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     ProductVariantImportDraft productVariantImportDraft = ProductVariantImportDraft.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 ProductVariantImportDraftBuilder implements Builder<ProductVariantImportDraft> {
025
026    @Nullable
027    private Long id;
028
029    @Nullable
030    private String sku;
031
032    @Nullable
033    private java.util.List<com.commercetools.api.models.common.PriceDraft> prices;
034
035    @Nullable
036    private java.util.List<com.commercetools.api.models.product.Attribute> attributes;
037
038    @Nullable
039    private java.util.List<com.commercetools.api.models.common.Image> images;
040
041    /**
042     *  <p>The sequential ID of the variant within the product. The variant with provided ID should exist in some existing product, so you also need to specify the productId if this property is set, or alternatively you can just specify SKU of the product variant.</p>
043     * @param id value to be set
044     * @return Builder
045     */
046
047    public ProductVariantImportDraftBuilder id(@Nullable final Long id) {
048        this.id = id;
049        return this;
050    }
051
052    /**
053     *  <p>The SKU of the existing variant.</p>
054     * @param sku value to be set
055     * @return Builder
056     */
057
058    public ProductVariantImportDraftBuilder sku(@Nullable final String sku) {
059        this.sku = sku;
060        return this;
061    }
062
063    /**
064     *  <p>The Embedded Prices of the variant. The prices should not contain two prices for the same price scope (same currency, country, customer group, channel, valid from and valid until). If this property is defined, then it will override the <code>prices</code> property from the original product variant, otherwise <code>prices</code> property from the original product variant would be copied in the resulting order.</p>
065     * @param prices value to be set
066     * @return Builder
067     */
068
069    public ProductVariantImportDraftBuilder prices(
070            @Nullable final com.commercetools.api.models.common.PriceDraft... prices) {
071        this.prices = new ArrayList<>(Arrays.asList(prices));
072        return this;
073    }
074
075    /**
076     *  <p>The Embedded Prices of the variant. The prices should not contain two prices for the same price scope (same currency, country, customer group, channel, valid from and valid until). If this property is defined, then it will override the <code>prices</code> property from the original product variant, otherwise <code>prices</code> property from the original product variant would be copied in the resulting order.</p>
077     * @param prices value to be set
078     * @return Builder
079     */
080
081    public ProductVariantImportDraftBuilder prices(
082            @Nullable final java.util.List<com.commercetools.api.models.common.PriceDraft> prices) {
083        this.prices = prices;
084        return this;
085    }
086
087    /**
088     *  <p>The Embedded Prices of the variant. The prices should not contain two prices for the same price scope (same currency, country, customer group, channel, valid from and valid until). If this property is defined, then it will override the <code>prices</code> property from the original product variant, otherwise <code>prices</code> property from the original product variant would be copied in the resulting order.</p>
089     * @param prices value to be set
090     * @return Builder
091     */
092
093    public ProductVariantImportDraftBuilder plusPrices(
094            @Nullable final com.commercetools.api.models.common.PriceDraft... prices) {
095        if (this.prices == null) {
096            this.prices = new ArrayList<>();
097        }
098        this.prices.addAll(Arrays.asList(prices));
099        return this;
100    }
101
102    /**
103     *  <p>The Embedded Prices of the variant. The prices should not contain two prices for the same price scope (same currency, country, customer group, channel, valid from and valid until). If this property is defined, then it will override the <code>prices</code> property from the original product variant, otherwise <code>prices</code> property from the original product variant would be copied in the resulting order.</p>
104     * @param builder function to build the prices value
105     * @return Builder
106     */
107
108    public ProductVariantImportDraftBuilder plusPrices(
109            Function<com.commercetools.api.models.common.PriceDraftBuilder, com.commercetools.api.models.common.PriceDraftBuilder> builder) {
110        if (this.prices == null) {
111            this.prices = new ArrayList<>();
112        }
113        this.prices.add(builder.apply(com.commercetools.api.models.common.PriceDraftBuilder.of()).build());
114        return this;
115    }
116
117    /**
118     *  <p>The Embedded Prices of the variant. The prices should not contain two prices for the same price scope (same currency, country, customer group, channel, valid from and valid until). If this property is defined, then it will override the <code>prices</code> property from the original product variant, otherwise <code>prices</code> property from the original product variant would be copied in the resulting order.</p>
119     * @param builder function to build the prices value
120     * @return Builder
121     */
122
123    public ProductVariantImportDraftBuilder withPrices(
124            Function<com.commercetools.api.models.common.PriceDraftBuilder, com.commercetools.api.models.common.PriceDraftBuilder> builder) {
125        this.prices = new ArrayList<>();
126        this.prices.add(builder.apply(com.commercetools.api.models.common.PriceDraftBuilder.of()).build());
127        return this;
128    }
129
130    /**
131     *  <p>The Embedded Prices of the variant. The prices should not contain two prices for the same price scope (same currency, country, customer group, channel, valid from and valid until). If this property is defined, then it will override the <code>prices</code> property from the original product variant, otherwise <code>prices</code> property from the original product variant would be copied in the resulting order.</p>
132     * @param builder function to build the prices value
133     * @return Builder
134     */
135
136    public ProductVariantImportDraftBuilder addPrices(
137            Function<com.commercetools.api.models.common.PriceDraftBuilder, com.commercetools.api.models.common.PriceDraft> builder) {
138        return plusPrices(builder.apply(com.commercetools.api.models.common.PriceDraftBuilder.of()));
139    }
140
141    /**
142     *  <p>The Embedded Prices of the variant. The prices should not contain two prices for the same price scope (same currency, country, customer group, channel, valid from and valid until). If this property is defined, then it will override the <code>prices</code> property from the original product variant, otherwise <code>prices</code> property from the original product variant would be copied in the resulting order.</p>
143     * @param builder function to build the prices value
144     * @return Builder
145     */
146
147    public ProductVariantImportDraftBuilder setPrices(
148            Function<com.commercetools.api.models.common.PriceDraftBuilder, com.commercetools.api.models.common.PriceDraft> builder) {
149        return prices(builder.apply(com.commercetools.api.models.common.PriceDraftBuilder.of()));
150    }
151
152    /**
153     *  <p>If this property is defined, then it will override the <code>attributes</code> property from the original product variant, otherwise <code>attributes</code> property from the original product variant would be copied in the resulting order.</p>
154     * @param attributes value to be set
155     * @return Builder
156     */
157
158    public ProductVariantImportDraftBuilder attributes(
159            @Nullable final com.commercetools.api.models.product.Attribute... attributes) {
160        this.attributes = new ArrayList<>(Arrays.asList(attributes));
161        return this;
162    }
163
164    /**
165     *  <p>If this property is defined, then it will override the <code>attributes</code> property from the original product variant, otherwise <code>attributes</code> property from the original product variant would be copied in the resulting order.</p>
166     * @param attributes value to be set
167     * @return Builder
168     */
169
170    public ProductVariantImportDraftBuilder attributes(
171            @Nullable final java.util.List<com.commercetools.api.models.product.Attribute> attributes) {
172        this.attributes = attributes;
173        return this;
174    }
175
176    /**
177     *  <p>If this property is defined, then it will override the <code>attributes</code> property from the original product variant, otherwise <code>attributes</code> property from the original product variant would be copied in the resulting order.</p>
178     * @param attributes value to be set
179     * @return Builder
180     */
181
182    public ProductVariantImportDraftBuilder plusAttributes(
183            @Nullable final com.commercetools.api.models.product.Attribute... attributes) {
184        if (this.attributes == null) {
185            this.attributes = new ArrayList<>();
186        }
187        this.attributes.addAll(Arrays.asList(attributes));
188        return this;
189    }
190
191    /**
192     *  <p>If this property is defined, then it will override the <code>attributes</code> property from the original product variant, otherwise <code>attributes</code> property from the original product variant would be copied in the resulting order.</p>
193     * @param builder function to build the attributes value
194     * @return Builder
195     */
196
197    public ProductVariantImportDraftBuilder plusAttributes(
198            Function<com.commercetools.api.models.product.AttributeBuilder, com.commercetools.api.models.product.AttributeBuilder> builder) {
199        if (this.attributes == null) {
200            this.attributes = new ArrayList<>();
201        }
202        this.attributes.add(builder.apply(com.commercetools.api.models.product.AttributeBuilder.of()).build());
203        return this;
204    }
205
206    /**
207     *  <p>If this property is defined, then it will override the <code>attributes</code> property from the original product variant, otherwise <code>attributes</code> property from the original product variant would be copied in the resulting order.</p>
208     * @param builder function to build the attributes value
209     * @return Builder
210     */
211
212    public ProductVariantImportDraftBuilder withAttributes(
213            Function<com.commercetools.api.models.product.AttributeBuilder, com.commercetools.api.models.product.AttributeBuilder> builder) {
214        this.attributes = new ArrayList<>();
215        this.attributes.add(builder.apply(com.commercetools.api.models.product.AttributeBuilder.of()).build());
216        return this;
217    }
218
219    /**
220     *  <p>If this property is defined, then it will override the <code>attributes</code> property from the original product variant, otherwise <code>attributes</code> property from the original product variant would be copied in the resulting order.</p>
221     * @param builder function to build the attributes value
222     * @return Builder
223     */
224
225    public ProductVariantImportDraftBuilder addAttributes(
226            Function<com.commercetools.api.models.product.AttributeBuilder, com.commercetools.api.models.product.Attribute> builder) {
227        return plusAttributes(builder.apply(com.commercetools.api.models.product.AttributeBuilder.of()));
228    }
229
230    /**
231     *  <p>If this property is defined, then it will override the <code>attributes</code> property from the original product variant, otherwise <code>attributes</code> property from the original product variant would be copied in the resulting order.</p>
232     * @param builder function to build the attributes value
233     * @return Builder
234     */
235
236    public ProductVariantImportDraftBuilder setAttributes(
237            Function<com.commercetools.api.models.product.AttributeBuilder, com.commercetools.api.models.product.Attribute> builder) {
238        return attributes(builder.apply(com.commercetools.api.models.product.AttributeBuilder.of()));
239    }
240
241    /**
242     *  <p>If this property is defined, then it will override the <code>images</code> property from the original product variant, otherwise <code>images</code> property from the original product variant would be copied in the resulting order.</p>
243     * @param images value to be set
244     * @return Builder
245     */
246
247    public ProductVariantImportDraftBuilder images(
248            @Nullable final com.commercetools.api.models.common.Image... images) {
249        this.images = new ArrayList<>(Arrays.asList(images));
250        return this;
251    }
252
253    /**
254     *  <p>If this property is defined, then it will override the <code>images</code> property from the original product variant, otherwise <code>images</code> property from the original product variant would be copied in the resulting order.</p>
255     * @param images value to be set
256     * @return Builder
257     */
258
259    public ProductVariantImportDraftBuilder images(
260            @Nullable final java.util.List<com.commercetools.api.models.common.Image> images) {
261        this.images = images;
262        return this;
263    }
264
265    /**
266     *  <p>If this property is defined, then it will override the <code>images</code> property from the original product variant, otherwise <code>images</code> property from the original product variant would be copied in the resulting order.</p>
267     * @param images value to be set
268     * @return Builder
269     */
270
271    public ProductVariantImportDraftBuilder plusImages(
272            @Nullable final com.commercetools.api.models.common.Image... images) {
273        if (this.images == null) {
274            this.images = new ArrayList<>();
275        }
276        this.images.addAll(Arrays.asList(images));
277        return this;
278    }
279
280    /**
281     *  <p>If this property is defined, then it will override the <code>images</code> property from the original product variant, otherwise <code>images</code> property from the original product variant would be copied in the resulting order.</p>
282     * @param builder function to build the images value
283     * @return Builder
284     */
285
286    public ProductVariantImportDraftBuilder plusImages(
287            Function<com.commercetools.api.models.common.ImageBuilder, com.commercetools.api.models.common.ImageBuilder> builder) {
288        if (this.images == null) {
289            this.images = new ArrayList<>();
290        }
291        this.images.add(builder.apply(com.commercetools.api.models.common.ImageBuilder.of()).build());
292        return this;
293    }
294
295    /**
296     *  <p>If this property is defined, then it will override the <code>images</code> property from the original product variant, otherwise <code>images</code> property from the original product variant would be copied in the resulting order.</p>
297     * @param builder function to build the images value
298     * @return Builder
299     */
300
301    public ProductVariantImportDraftBuilder withImages(
302            Function<com.commercetools.api.models.common.ImageBuilder, com.commercetools.api.models.common.ImageBuilder> builder) {
303        this.images = new ArrayList<>();
304        this.images.add(builder.apply(com.commercetools.api.models.common.ImageBuilder.of()).build());
305        return this;
306    }
307
308    /**
309     *  <p>If this property is defined, then it will override the <code>images</code> property from the original product variant, otherwise <code>images</code> property from the original product variant would be copied in the resulting order.</p>
310     * @param builder function to build the images value
311     * @return Builder
312     */
313
314    public ProductVariantImportDraftBuilder addImages(
315            Function<com.commercetools.api.models.common.ImageBuilder, com.commercetools.api.models.common.Image> builder) {
316        return plusImages(builder.apply(com.commercetools.api.models.common.ImageBuilder.of()));
317    }
318
319    /**
320     *  <p>If this property is defined, then it will override the <code>images</code> property from the original product variant, otherwise <code>images</code> property from the original product variant would be copied in the resulting order.</p>
321     * @param builder function to build the images value
322     * @return Builder
323     */
324
325    public ProductVariantImportDraftBuilder setImages(
326            Function<com.commercetools.api.models.common.ImageBuilder, com.commercetools.api.models.common.Image> builder) {
327        return images(builder.apply(com.commercetools.api.models.common.ImageBuilder.of()));
328    }
329
330    /**
331     *  <p>The sequential ID of the variant within the product. The variant with provided ID should exist in some existing product, so you also need to specify the productId if this property is set, or alternatively you can just specify SKU of the product variant.</p>
332     * @return id
333     */
334
335    @Nullable
336    public Long getId() {
337        return this.id;
338    }
339
340    /**
341     *  <p>The SKU of the existing variant.</p>
342     * @return sku
343     */
344
345    @Nullable
346    public String getSku() {
347        return this.sku;
348    }
349
350    /**
351     *  <p>The Embedded Prices of the variant. The prices should not contain two prices for the same price scope (same currency, country, customer group, channel, valid from and valid until). If this property is defined, then it will override the <code>prices</code> property from the original product variant, otherwise <code>prices</code> property from the original product variant would be copied in the resulting order.</p>
352     * @return prices
353     */
354
355    @Nullable
356    public java.util.List<com.commercetools.api.models.common.PriceDraft> getPrices() {
357        return this.prices;
358    }
359
360    /**
361     *  <p>If this property is defined, then it will override the <code>attributes</code> property from the original product variant, otherwise <code>attributes</code> property from the original product variant would be copied in the resulting order.</p>
362     * @return attributes
363     */
364
365    @Nullable
366    public java.util.List<com.commercetools.api.models.product.Attribute> getAttributes() {
367        return this.attributes;
368    }
369
370    /**
371     *  <p>If this property is defined, then it will override the <code>images</code> property from the original product variant, otherwise <code>images</code> property from the original product variant would be copied in the resulting order.</p>
372     * @return images
373     */
374
375    @Nullable
376    public java.util.List<com.commercetools.api.models.common.Image> getImages() {
377        return this.images;
378    }
379
380    /**
381     * builds ProductVariantImportDraft with checking for non-null required values
382     * @return ProductVariantImportDraft
383     */
384    public ProductVariantImportDraft build() {
385        return new ProductVariantImportDraftImpl(id, sku, prices, attributes, images);
386    }
387
388    /**
389     * builds ProductVariantImportDraft without checking for non-null required values
390     * @return ProductVariantImportDraft
391     */
392    public ProductVariantImportDraft buildUnchecked() {
393        return new ProductVariantImportDraftImpl(id, sku, prices, attributes, images);
394    }
395
396    /**
397     * factory method for an instance of ProductVariantImportDraftBuilder
398     * @return builder
399     */
400    public static ProductVariantImportDraftBuilder of() {
401        return new ProductVariantImportDraftBuilder();
402    }
403
404    /**
405     * create builder for ProductVariantImportDraft instance
406     * @param template instance with prefilled values for the builder
407     * @return builder
408     */
409    public static ProductVariantImportDraftBuilder of(final ProductVariantImportDraft template) {
410        ProductVariantImportDraftBuilder builder = new ProductVariantImportDraftBuilder();
411        builder.id = template.getId();
412        builder.sku = template.getSku();
413        builder.prices = template.getPrices();
414        builder.attributes = template.getAttributes();
415        builder.images = template.getImages();
416        return builder;
417    }
418
419}