001
002package com.commercetools.api.models.message;
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 * ProductPriceDiscountsSetMessageBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     ProductPriceDiscountsSetMessage productPriceDiscountsSetMessage = ProductPriceDiscountsSetMessage.builder()
019 *             .id("{id}")
020 *             .version(0.3)
021 *             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
022 *             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
023 *             .sequenceNumber(0.3)
024 *             .resource(resourceBuilder -> resourceBuilder)
025 *             .resourceVersion(0.3)
026 *             .plusUpdatedPrices(updatedPricesBuilder -> updatedPricesBuilder)
027 *             .build()
028 * </code></pre>
029 * </div>
030 */
031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
032public class ProductPriceDiscountsSetMessageBuilder implements Builder<ProductPriceDiscountsSetMessage> {
033
034    private String id;
035
036    private Long version;
037
038    private java.time.ZonedDateTime createdAt;
039
040    private java.time.ZonedDateTime lastModifiedAt;
041
042    @Nullable
043    private com.commercetools.api.models.common.LastModifiedBy lastModifiedBy;
044
045    @Nullable
046    private com.commercetools.api.models.common.CreatedBy createdBy;
047
048    private Long sequenceNumber;
049
050    private com.commercetools.api.models.common.Reference resource;
051
052    private Long resourceVersion;
053
054    @Nullable
055    private com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers;
056
057    private java.util.List<com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPrice> updatedPrices;
058
059    /**
060     *  <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p>
061     * @param id value to be set
062     * @return Builder
063     */
064
065    public ProductPriceDiscountsSetMessageBuilder id(final String id) {
066        this.id = id;
067        return this;
068    }
069
070    /**
071     *  <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p>
072     * @param version value to be set
073     * @return Builder
074     */
075
076    public ProductPriceDiscountsSetMessageBuilder version(final Long version) {
077        this.version = version;
078        return this;
079    }
080
081    /**
082     *  <p>Date and time (UTC) the Message was generated.</p>
083     * @param createdAt value to be set
084     * @return Builder
085     */
086
087    public ProductPriceDiscountsSetMessageBuilder createdAt(final java.time.ZonedDateTime createdAt) {
088        this.createdAt = createdAt;
089        return this;
090    }
091
092    /**
093     *  <p>Value of <code>createdAt</code>.</p>
094     * @param lastModifiedAt value to be set
095     * @return Builder
096     */
097
098    public ProductPriceDiscountsSetMessageBuilder lastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) {
099        this.lastModifiedAt = lastModifiedAt;
100        return this;
101    }
102
103    /**
104     *  <p>Value of <code>createdBy</code>.</p>
105     * @param builder function to build the lastModifiedBy value
106     * @return Builder
107     */
108
109    public ProductPriceDiscountsSetMessageBuilder lastModifiedBy(
110            Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedByBuilder> builder) {
111        this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()).build();
112        return this;
113    }
114
115    /**
116     *  <p>Value of <code>createdBy</code>.</p>
117     * @param builder function to build the lastModifiedBy value
118     * @return Builder
119     */
120
121    public ProductPriceDiscountsSetMessageBuilder withLastModifiedBy(
122            Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedBy> builder) {
123        this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of());
124        return this;
125    }
126
127    /**
128     *  <p>Value of <code>createdBy</code>.</p>
129     * @param lastModifiedBy value to be set
130     * @return Builder
131     */
132
133    public ProductPriceDiscountsSetMessageBuilder lastModifiedBy(
134            @Nullable final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) {
135        this.lastModifiedBy = lastModifiedBy;
136        return this;
137    }
138
139    /**
140     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
141     * @param builder function to build the createdBy value
142     * @return Builder
143     */
144
145    public ProductPriceDiscountsSetMessageBuilder createdBy(
146            Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedByBuilder> builder) {
147        this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()).build();
148        return this;
149    }
150
151    /**
152     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
153     * @param builder function to build the createdBy value
154     * @return Builder
155     */
156
157    public ProductPriceDiscountsSetMessageBuilder withCreatedBy(
158            Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedBy> builder) {
159        this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of());
160        return this;
161    }
162
163    /**
164     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
165     * @param createdBy value to be set
166     * @return Builder
167     */
168
169    public ProductPriceDiscountsSetMessageBuilder createdBy(
170            @Nullable final com.commercetools.api.models.common.CreatedBy createdBy) {
171        this.createdBy = createdBy;
172        return this;
173    }
174
175    /**
176     *  <p>Message number in relation to other Messages for a given resource. The <code>sequenceNumber</code> of the next Message for the resource is the successor of the <code>sequenceNumber</code> of the current Message. Meaning, the <code>sequenceNumber</code> of the next Message equals the <code>sequenceNumber</code> of the current Message + 1. <code>sequenceNumber</code> can be used to ensure that Messages are processed in the correct order for a particular resource.</p>
177     * @param sequenceNumber value to be set
178     * @return Builder
179     */
180
181    public ProductPriceDiscountsSetMessageBuilder sequenceNumber(final Long sequenceNumber) {
182        this.sequenceNumber = sequenceNumber;
183        return this;
184    }
185
186    /**
187     *  <p>Reference to the resource on which the change or action was performed.</p>
188     * @param resource value to be set
189     * @return Builder
190     */
191
192    public ProductPriceDiscountsSetMessageBuilder resource(
193            final com.commercetools.api.models.common.Reference resource) {
194        this.resource = resource;
195        return this;
196    }
197
198    /**
199     *  <p>Reference to the resource on which the change or action was performed.</p>
200     * @param builder function to build the resource value
201     * @return Builder
202     */
203
204    public ProductPriceDiscountsSetMessageBuilder resource(
205            Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) {
206        this.resource = builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build();
207        return this;
208    }
209
210    /**
211     *  <p>Version of the resource on which the change or action was performed.</p>
212     * @param resourceVersion value to be set
213     * @return Builder
214     */
215
216    public ProductPriceDiscountsSetMessageBuilder resourceVersion(final Long resourceVersion) {
217        this.resourceVersion = resourceVersion;
218        return this;
219    }
220
221    /**
222     *  <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p>
223     * @param builder function to build the resourceUserProvidedIdentifiers value
224     * @return Builder
225     */
226
227    public ProductPriceDiscountsSetMessageBuilder resourceUserProvidedIdentifiers(
228            Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiersBuilder> builder) {
229        this.resourceUserProvidedIdentifiers = builder
230                .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of())
231                .build();
232        return this;
233    }
234
235    /**
236     *  <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p>
237     * @param builder function to build the resourceUserProvidedIdentifiers value
238     * @return Builder
239     */
240
241    public ProductPriceDiscountsSetMessageBuilder withResourceUserProvidedIdentifiers(
242            Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiers> builder) {
243        this.resourceUserProvidedIdentifiers = builder
244                .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of());
245        return this;
246    }
247
248    /**
249     *  <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p>
250     * @param resourceUserProvidedIdentifiers value to be set
251     * @return Builder
252     */
253
254    public ProductPriceDiscountsSetMessageBuilder resourceUserProvidedIdentifiers(
255            @Nullable final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) {
256        this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers;
257        return this;
258    }
259
260    /**
261     *  <p>Array containing details about the Embedded Prices that were updated.</p>
262     * @param updatedPrices value to be set
263     * @return Builder
264     */
265
266    public ProductPriceDiscountsSetMessageBuilder updatedPrices(
267            final com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPrice... updatedPrices) {
268        this.updatedPrices = new ArrayList<>(Arrays.asList(updatedPrices));
269        return this;
270    }
271
272    /**
273     *  <p>Array containing details about the Embedded Prices that were updated.</p>
274     * @param updatedPrices value to be set
275     * @return Builder
276     */
277
278    public ProductPriceDiscountsSetMessageBuilder updatedPrices(
279            final java.util.List<com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPrice> updatedPrices) {
280        this.updatedPrices = updatedPrices;
281        return this;
282    }
283
284    /**
285     *  <p>Array containing details about the Embedded Prices that were updated.</p>
286     * @param updatedPrices value to be set
287     * @return Builder
288     */
289
290    public ProductPriceDiscountsSetMessageBuilder plusUpdatedPrices(
291            final com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPrice... updatedPrices) {
292        if (this.updatedPrices == null) {
293            this.updatedPrices = new ArrayList<>();
294        }
295        this.updatedPrices.addAll(Arrays.asList(updatedPrices));
296        return this;
297    }
298
299    /**
300     *  <p>Array containing details about the Embedded Prices that were updated.</p>
301     * @param builder function to build the updatedPrices value
302     * @return Builder
303     */
304
305    public ProductPriceDiscountsSetMessageBuilder plusUpdatedPrices(
306            Function<com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder, com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder> builder) {
307        if (this.updatedPrices == null) {
308            this.updatedPrices = new ArrayList<>();
309        }
310        this.updatedPrices.add(
311            builder.apply(com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder.of())
312                    .build());
313        return this;
314    }
315
316    /**
317     *  <p>Array containing details about the Embedded Prices that were updated.</p>
318     * @param builder function to build the updatedPrices value
319     * @return Builder
320     */
321
322    public ProductPriceDiscountsSetMessageBuilder withUpdatedPrices(
323            Function<com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder, com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder> builder) {
324        this.updatedPrices = new ArrayList<>();
325        this.updatedPrices.add(
326            builder.apply(com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder.of())
327                    .build());
328        return this;
329    }
330
331    /**
332     *  <p>Array containing details about the Embedded Prices that were updated.</p>
333     * @param builder function to build the updatedPrices value
334     * @return Builder
335     */
336
337    public ProductPriceDiscountsSetMessageBuilder addUpdatedPrices(
338            Function<com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder, com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPrice> builder) {
339        return plusUpdatedPrices(
340            builder.apply(com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder.of()));
341    }
342
343    /**
344     *  <p>Array containing details about the Embedded Prices that were updated.</p>
345     * @param builder function to build the updatedPrices value
346     * @return Builder
347     */
348
349    public ProductPriceDiscountsSetMessageBuilder setUpdatedPrices(
350            Function<com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder, com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPrice> builder) {
351        return updatedPrices(
352            builder.apply(com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPriceBuilder.of()));
353    }
354
355    /**
356     *  <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p>
357     * @return id
358     */
359
360    public String getId() {
361        return this.id;
362    }
363
364    /**
365     *  <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p>
366     * @return version
367     */
368
369    public Long getVersion() {
370        return this.version;
371    }
372
373    /**
374     *  <p>Date and time (UTC) the Message was generated.</p>
375     * @return createdAt
376     */
377
378    public java.time.ZonedDateTime getCreatedAt() {
379        return this.createdAt;
380    }
381
382    /**
383     *  <p>Value of <code>createdAt</code>.</p>
384     * @return lastModifiedAt
385     */
386
387    public java.time.ZonedDateTime getLastModifiedAt() {
388        return this.lastModifiedAt;
389    }
390
391    /**
392     *  <p>Value of <code>createdBy</code>.</p>
393     * @return lastModifiedBy
394     */
395
396    @Nullable
397    public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() {
398        return this.lastModifiedBy;
399    }
400
401    /**
402     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
403     * @return createdBy
404     */
405
406    @Nullable
407    public com.commercetools.api.models.common.CreatedBy getCreatedBy() {
408        return this.createdBy;
409    }
410
411    /**
412     *  <p>Message number in relation to other Messages for a given resource. The <code>sequenceNumber</code> of the next Message for the resource is the successor of the <code>sequenceNumber</code> of the current Message. Meaning, the <code>sequenceNumber</code> of the next Message equals the <code>sequenceNumber</code> of the current Message + 1. <code>sequenceNumber</code> can be used to ensure that Messages are processed in the correct order for a particular resource.</p>
413     * @return sequenceNumber
414     */
415
416    public Long getSequenceNumber() {
417        return this.sequenceNumber;
418    }
419
420    /**
421     *  <p>Reference to the resource on which the change or action was performed.</p>
422     * @return resource
423     */
424
425    public com.commercetools.api.models.common.Reference getResource() {
426        return this.resource;
427    }
428
429    /**
430     *  <p>Version of the resource on which the change or action was performed.</p>
431     * @return resourceVersion
432     */
433
434    public Long getResourceVersion() {
435        return this.resourceVersion;
436    }
437
438    /**
439     *  <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p>
440     * @return resourceUserProvidedIdentifiers
441     */
442
443    @Nullable
444    public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() {
445        return this.resourceUserProvidedIdentifiers;
446    }
447
448    /**
449     *  <p>Array containing details about the Embedded Prices that were updated.</p>
450     * @return updatedPrices
451     */
452
453    public java.util.List<com.commercetools.api.models.message.ProductPriceDiscountsSetUpdatedPrice> getUpdatedPrices() {
454        return this.updatedPrices;
455    }
456
457    /**
458     * builds ProductPriceDiscountsSetMessage with checking for non-null required values
459     * @return ProductPriceDiscountsSetMessage
460     */
461    public ProductPriceDiscountsSetMessage build() {
462        Objects.requireNonNull(id, ProductPriceDiscountsSetMessage.class + ": id is missing");
463        Objects.requireNonNull(version, ProductPriceDiscountsSetMessage.class + ": version is missing");
464        Objects.requireNonNull(createdAt, ProductPriceDiscountsSetMessage.class + ": createdAt is missing");
465        Objects.requireNonNull(lastModifiedAt, ProductPriceDiscountsSetMessage.class + ": lastModifiedAt is missing");
466        Objects.requireNonNull(sequenceNumber, ProductPriceDiscountsSetMessage.class + ": sequenceNumber is missing");
467        Objects.requireNonNull(resource, ProductPriceDiscountsSetMessage.class + ": resource is missing");
468        Objects.requireNonNull(resourceVersion, ProductPriceDiscountsSetMessage.class + ": resourceVersion is missing");
469        Objects.requireNonNull(updatedPrices, ProductPriceDiscountsSetMessage.class + ": updatedPrices is missing");
470        return new ProductPriceDiscountsSetMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy,
471            createdBy, sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, updatedPrices);
472    }
473
474    /**
475     * builds ProductPriceDiscountsSetMessage without checking for non-null required values
476     * @return ProductPriceDiscountsSetMessage
477     */
478    public ProductPriceDiscountsSetMessage buildUnchecked() {
479        return new ProductPriceDiscountsSetMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy,
480            createdBy, sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, updatedPrices);
481    }
482
483    /**
484     * factory method for an instance of ProductPriceDiscountsSetMessageBuilder
485     * @return builder
486     */
487    public static ProductPriceDiscountsSetMessageBuilder of() {
488        return new ProductPriceDiscountsSetMessageBuilder();
489    }
490
491    /**
492     * create builder for ProductPriceDiscountsSetMessage instance
493     * @param template instance with prefilled values for the builder
494     * @return builder
495     */
496    public static ProductPriceDiscountsSetMessageBuilder of(final ProductPriceDiscountsSetMessage template) {
497        ProductPriceDiscountsSetMessageBuilder builder = new ProductPriceDiscountsSetMessageBuilder();
498        builder.id = template.getId();
499        builder.version = template.getVersion();
500        builder.createdAt = template.getCreatedAt();
501        builder.lastModifiedAt = template.getLastModifiedAt();
502        builder.lastModifiedBy = template.getLastModifiedBy();
503        builder.createdBy = template.getCreatedBy();
504        builder.sequenceNumber = template.getSequenceNumber();
505        builder.resource = template.getResource();
506        builder.resourceVersion = template.getResourceVersion();
507        builder.resourceUserProvidedIdentifiers = template.getResourceUserProvidedIdentifiers();
508        builder.updatedPrices = template.getUpdatedPrices();
509        return builder;
510    }
511
512}