001
002package com.commercetools.api.models.discount_code;
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 * DiscountCodeBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     DiscountCode discountCode = DiscountCode.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 *             .code("{code}")
024 *             .plusCartDiscounts(cartDiscountsBuilder -> cartDiscountsBuilder)
025 *             .isActive(true)
026 *             .plusReferences(referencesBuilder -> referencesBuilder)
027 *             .plusGroups(groupsBuilder -> groupsBuilder)
028 *             .build()
029 * </code></pre>
030 * </div>
031 */
032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
033public class DiscountCodeBuilder implements Builder<DiscountCode> {
034
035    private String id;
036
037    private Long version;
038
039    private java.time.ZonedDateTime createdAt;
040
041    private java.time.ZonedDateTime lastModifiedAt;
042
043    @Nullable
044    private com.commercetools.api.models.common.LastModifiedBy lastModifiedBy;
045
046    @Nullable
047    private com.commercetools.api.models.common.CreatedBy createdBy;
048
049    @Nullable
050    private com.commercetools.api.models.common.LocalizedString name;
051
052    @Nullable
053    private com.commercetools.api.models.common.LocalizedString description;
054
055    private String code;
056
057    private java.util.List<com.commercetools.api.models.cart_discount.CartDiscountReference> cartDiscounts;
058
059    @Nullable
060    private String cartPredicate;
061
062    private Boolean isActive;
063
064    private java.util.List<com.commercetools.api.models.common.Reference> references;
065
066    @Nullable
067    private Long maxApplications;
068
069    @Nullable
070    private Long maxApplicationsPerCustomer;
071
072    @Nullable
073    private com.commercetools.api.models.type.CustomFields custom;
074
075    private java.util.List<String> groups;
076
077    @Nullable
078    private java.time.ZonedDateTime validFrom;
079
080    @Nullable
081    private java.time.ZonedDateTime validUntil;
082
083    @Nullable
084    private Long applicationVersion;
085
086    /**
087     *  <p>Unique identifier of the DiscountCode.</p>
088     * @param id value to be set
089     * @return Builder
090     */
091
092    public DiscountCodeBuilder id(final String id) {
093        this.id = id;
094        return this;
095    }
096
097    /**
098     *  <p>Current version of the DiscountCode.</p>
099     * @param version value to be set
100     * @return Builder
101     */
102
103    public DiscountCodeBuilder version(final Long version) {
104        this.version = version;
105        return this;
106    }
107
108    /**
109     *  <p>Date and time (UTC) the DiscountCode was initially created.</p>
110     * @param createdAt value to be set
111     * @return Builder
112     */
113
114    public DiscountCodeBuilder createdAt(final java.time.ZonedDateTime createdAt) {
115        this.createdAt = createdAt;
116        return this;
117    }
118
119    /**
120     *  <p>Date and time (UTC) the DiscountCode was last updated.</p>
121     * @param lastModifiedAt value to be set
122     * @return Builder
123     */
124
125    public DiscountCodeBuilder lastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) {
126        this.lastModifiedAt = lastModifiedAt;
127        return this;
128    }
129
130    /**
131     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
132     * @param builder function to build the lastModifiedBy value
133     * @return Builder
134     */
135
136    public DiscountCodeBuilder lastModifiedBy(
137            Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedByBuilder> builder) {
138        this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()).build();
139        return this;
140    }
141
142    /**
143     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
144     * @param builder function to build the lastModifiedBy value
145     * @return Builder
146     */
147
148    public DiscountCodeBuilder withLastModifiedBy(
149            Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedBy> builder) {
150        this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of());
151        return this;
152    }
153
154    /**
155     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
156     * @param lastModifiedBy value to be set
157     * @return Builder
158     */
159
160    public DiscountCodeBuilder lastModifiedBy(
161            @Nullable final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) {
162        this.lastModifiedBy = lastModifiedBy;
163        return this;
164    }
165
166    /**
167     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
168     * @param builder function to build the createdBy value
169     * @return Builder
170     */
171
172    public DiscountCodeBuilder createdBy(
173            Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedByBuilder> builder) {
174        this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()).build();
175        return this;
176    }
177
178    /**
179     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
180     * @param builder function to build the createdBy value
181     * @return Builder
182     */
183
184    public DiscountCodeBuilder withCreatedBy(
185            Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedBy> builder) {
186        this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of());
187        return this;
188    }
189
190    /**
191     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
192     * @param createdBy value to be set
193     * @return Builder
194     */
195
196    public DiscountCodeBuilder createdBy(@Nullable final com.commercetools.api.models.common.CreatedBy createdBy) {
197        this.createdBy = createdBy;
198        return this;
199    }
200
201    /**
202     *  <p>Name of the DiscountCode.</p>
203     * @param builder function to build the name value
204     * @return Builder
205     */
206
207    public DiscountCodeBuilder name(
208            Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedStringBuilder> builder) {
209        this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of()).build();
210        return this;
211    }
212
213    /**
214     *  <p>Name of the DiscountCode.</p>
215     * @param builder function to build the name value
216     * @return Builder
217     */
218
219    public DiscountCodeBuilder withName(
220            Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedString> builder) {
221        this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of());
222        return this;
223    }
224
225    /**
226     *  <p>Name of the DiscountCode.</p>
227     * @param name value to be set
228     * @return Builder
229     */
230
231    public DiscountCodeBuilder name(@Nullable final com.commercetools.api.models.common.LocalizedString name) {
232        this.name = name;
233        return this;
234    }
235
236    /**
237     *  <p>Description of the DiscountCode.</p>
238     * @param builder function to build the description value
239     * @return Builder
240     */
241
242    public DiscountCodeBuilder description(
243            Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedStringBuilder> builder) {
244        this.description = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of()).build();
245        return this;
246    }
247
248    /**
249     *  <p>Description of the DiscountCode.</p>
250     * @param builder function to build the description value
251     * @return Builder
252     */
253
254    public DiscountCodeBuilder withDescription(
255            Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedString> builder) {
256        this.description = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of());
257        return this;
258    }
259
260    /**
261     *  <p>Description of the DiscountCode.</p>
262     * @param description value to be set
263     * @return Builder
264     */
265
266    public DiscountCodeBuilder description(
267            @Nullable final com.commercetools.api.models.common.LocalizedString description) {
268        this.description = description;
269        return this;
270    }
271
272    /**
273     *  <p>User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.</p>
274     * @param code value to be set
275     * @return Builder
276     */
277
278    public DiscountCodeBuilder code(final String code) {
279        this.code = code;
280        return this;
281    }
282
283    /**
284     *  <p>Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.</p>
285     * @param cartDiscounts value to be set
286     * @return Builder
287     */
288
289    public DiscountCodeBuilder cartDiscounts(
290            final com.commercetools.api.models.cart_discount.CartDiscountReference... cartDiscounts) {
291        this.cartDiscounts = new ArrayList<>(Arrays.asList(cartDiscounts));
292        return this;
293    }
294
295    /**
296     *  <p>Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.</p>
297     * @param cartDiscounts value to be set
298     * @return Builder
299     */
300
301    public DiscountCodeBuilder cartDiscounts(
302            final java.util.List<com.commercetools.api.models.cart_discount.CartDiscountReference> cartDiscounts) {
303        this.cartDiscounts = cartDiscounts;
304        return this;
305    }
306
307    /**
308     *  <p>Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.</p>
309     * @param cartDiscounts value to be set
310     * @return Builder
311     */
312
313    public DiscountCodeBuilder plusCartDiscounts(
314            final com.commercetools.api.models.cart_discount.CartDiscountReference... cartDiscounts) {
315        if (this.cartDiscounts == null) {
316            this.cartDiscounts = new ArrayList<>();
317        }
318        this.cartDiscounts.addAll(Arrays.asList(cartDiscounts));
319        return this;
320    }
321
322    /**
323     *  <p>Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.</p>
324     * @param builder function to build the cartDiscounts value
325     * @return Builder
326     */
327
328    public DiscountCodeBuilder plusCartDiscounts(
329            Function<com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder, com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder> builder) {
330        if (this.cartDiscounts == null) {
331            this.cartDiscounts = new ArrayList<>();
332        }
333        this.cartDiscounts.add(
334            builder.apply(com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder.of()).build());
335        return this;
336    }
337
338    /**
339     *  <p>Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.</p>
340     * @param builder function to build the cartDiscounts value
341     * @return Builder
342     */
343
344    public DiscountCodeBuilder withCartDiscounts(
345            Function<com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder, com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder> builder) {
346        this.cartDiscounts = new ArrayList<>();
347        this.cartDiscounts.add(
348            builder.apply(com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder.of()).build());
349        return this;
350    }
351
352    /**
353     *  <p>Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.</p>
354     * @param builder function to build the cartDiscounts value
355     * @return Builder
356     */
357
358    public DiscountCodeBuilder addCartDiscounts(
359            Function<com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder, com.commercetools.api.models.cart_discount.CartDiscountReference> builder) {
360        return plusCartDiscounts(
361            builder.apply(com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder.of()));
362    }
363
364    /**
365     *  <p>Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.</p>
366     * @param builder function to build the cartDiscounts value
367     * @return Builder
368     */
369
370    public DiscountCodeBuilder setCartDiscounts(
371            Function<com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder, com.commercetools.api.models.cart_discount.CartDiscountReference> builder) {
372        return cartDiscounts(
373            builder.apply(com.commercetools.api.models.cart_discount.CartDiscountReferenceBuilder.of()));
374    }
375
376    /**
377     *  <p>DiscountCode can only be applied to Carts that match this predicate.</p>
378     * @param cartPredicate value to be set
379     * @return Builder
380     */
381
382    public DiscountCodeBuilder cartPredicate(@Nullable final String cartPredicate) {
383        this.cartPredicate = cartPredicate;
384        return this;
385    }
386
387    /**
388     *  <p>Indicates if the DiscountCode is active and can be applied to the Cart.</p>
389     * @param isActive value to be set
390     * @return Builder
391     */
392
393    public DiscountCodeBuilder isActive(final Boolean isActive) {
394        this.isActive = isActive;
395        return this;
396    }
397
398    /**
399     *  <p>Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.</p>
400     * @param references value to be set
401     * @return Builder
402     */
403
404    public DiscountCodeBuilder references(final com.commercetools.api.models.common.Reference... references) {
405        this.references = new ArrayList<>(Arrays.asList(references));
406        return this;
407    }
408
409    /**
410     *  <p>Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.</p>
411     * @param references value to be set
412     * @return Builder
413     */
414
415    public DiscountCodeBuilder references(
416            final java.util.List<com.commercetools.api.models.common.Reference> references) {
417        this.references = references;
418        return this;
419    }
420
421    /**
422     *  <p>Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.</p>
423     * @param references value to be set
424     * @return Builder
425     */
426
427    public DiscountCodeBuilder plusReferences(final com.commercetools.api.models.common.Reference... references) {
428        if (this.references == null) {
429            this.references = new ArrayList<>();
430        }
431        this.references.addAll(Arrays.asList(references));
432        return this;
433    }
434
435    /**
436     *  <p>Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.</p>
437     * @param builder function to build the references value
438     * @return Builder
439     */
440
441    public DiscountCodeBuilder plusReferences(
442            Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) {
443        if (this.references == null) {
444            this.references = new ArrayList<>();
445        }
446        this.references.add(builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build());
447        return this;
448    }
449
450    /**
451     *  <p>Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.</p>
452     * @param builder function to build the references value
453     * @return Builder
454     */
455
456    public DiscountCodeBuilder withReferences(
457            Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) {
458        this.references = new ArrayList<>();
459        this.references.add(builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build());
460        return this;
461    }
462
463    /**
464     *  <p>Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.</p>
465     * @param maxApplications value to be set
466     * @return Builder
467     */
468
469    public DiscountCodeBuilder maxApplications(@Nullable final Long maxApplications) {
470        this.maxApplications = maxApplications;
471        return this;
472    }
473
474    /**
475     *  <p>Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported). DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.</p>
476     * @param maxApplicationsPerCustomer value to be set
477     * @return Builder
478     */
479
480    public DiscountCodeBuilder maxApplicationsPerCustomer(@Nullable final Long maxApplicationsPerCustomer) {
481        this.maxApplicationsPerCustomer = maxApplicationsPerCustomer;
482        return this;
483    }
484
485    /**
486     *  <p>Custom Fields of the DiscountCode.</p>
487     * @param builder function to build the custom value
488     * @return Builder
489     */
490
491    public DiscountCodeBuilder custom(
492            Function<com.commercetools.api.models.type.CustomFieldsBuilder, com.commercetools.api.models.type.CustomFieldsBuilder> builder) {
493        this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsBuilder.of()).build();
494        return this;
495    }
496
497    /**
498     *  <p>Custom Fields of the DiscountCode.</p>
499     * @param builder function to build the custom value
500     * @return Builder
501     */
502
503    public DiscountCodeBuilder withCustom(
504            Function<com.commercetools.api.models.type.CustomFieldsBuilder, com.commercetools.api.models.type.CustomFields> builder) {
505        this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsBuilder.of());
506        return this;
507    }
508
509    /**
510     *  <p>Custom Fields of the DiscountCode.</p>
511     * @param custom value to be set
512     * @return Builder
513     */
514
515    public DiscountCodeBuilder custom(@Nullable final com.commercetools.api.models.type.CustomFields custom) {
516        this.custom = custom;
517        return this;
518    }
519
520    /**
521     *  <p>Groups to which the DiscountCode belongs to.</p>
522     * @param groups value to be set
523     * @return Builder
524     */
525
526    public DiscountCodeBuilder groups(final String... groups) {
527        this.groups = new ArrayList<>(Arrays.asList(groups));
528        return this;
529    }
530
531    /**
532     *  <p>Groups to which the DiscountCode belongs to.</p>
533     * @param groups value to be set
534     * @return Builder
535     */
536
537    public DiscountCodeBuilder groups(final java.util.List<String> groups) {
538        this.groups = groups;
539        return this;
540    }
541
542    /**
543     *  <p>Groups to which the DiscountCode belongs to.</p>
544     * @param groups value to be set
545     * @return Builder
546     */
547
548    public DiscountCodeBuilder plusGroups(final String... groups) {
549        if (this.groups == null) {
550            this.groups = new ArrayList<>();
551        }
552        this.groups.addAll(Arrays.asList(groups));
553        return this;
554    }
555
556    /**
557     *  <p>Date and time (UTC) from which the DiscountCode is effective.</p>
558     * @param validFrom value to be set
559     * @return Builder
560     */
561
562    public DiscountCodeBuilder validFrom(@Nullable final java.time.ZonedDateTime validFrom) {
563        this.validFrom = validFrom;
564        return this;
565    }
566
567    /**
568     *  <p>Date and time (UTC) until which the DiscountCode is effective.</p>
569     * @param validUntil value to be set
570     * @return Builder
571     */
572
573    public DiscountCodeBuilder validUntil(@Nullable final java.time.ZonedDateTime validUntil) {
574        this.validUntil = validUntil;
575        return this;
576    }
577
578    /**
579     *  <p>Used and managed by the API and must not be used in customer logic. The value can change at any time due to internal and external factors.</p>
580     * @param applicationVersion value to be set
581     * @return Builder
582     */
583
584    public DiscountCodeBuilder applicationVersion(@Nullable final Long applicationVersion) {
585        this.applicationVersion = applicationVersion;
586        return this;
587    }
588
589    /**
590     *  <p>Unique identifier of the DiscountCode.</p>
591     * @return id
592     */
593
594    public String getId() {
595        return this.id;
596    }
597
598    /**
599     *  <p>Current version of the DiscountCode.</p>
600     * @return version
601     */
602
603    public Long getVersion() {
604        return this.version;
605    }
606
607    /**
608     *  <p>Date and time (UTC) the DiscountCode was initially created.</p>
609     * @return createdAt
610     */
611
612    public java.time.ZonedDateTime getCreatedAt() {
613        return this.createdAt;
614    }
615
616    /**
617     *  <p>Date and time (UTC) the DiscountCode was last updated.</p>
618     * @return lastModifiedAt
619     */
620
621    public java.time.ZonedDateTime getLastModifiedAt() {
622        return this.lastModifiedAt;
623    }
624
625    /**
626     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
627     * @return lastModifiedBy
628     */
629
630    @Nullable
631    public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() {
632        return this.lastModifiedBy;
633    }
634
635    /**
636     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
637     * @return createdBy
638     */
639
640    @Nullable
641    public com.commercetools.api.models.common.CreatedBy getCreatedBy() {
642        return this.createdBy;
643    }
644
645    /**
646     *  <p>Name of the DiscountCode.</p>
647     * @return name
648     */
649
650    @Nullable
651    public com.commercetools.api.models.common.LocalizedString getName() {
652        return this.name;
653    }
654
655    /**
656     *  <p>Description of the DiscountCode.</p>
657     * @return description
658     */
659
660    @Nullable
661    public com.commercetools.api.models.common.LocalizedString getDescription() {
662        return this.description;
663    }
664
665    /**
666     *  <p>User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.</p>
667     * @return code
668     */
669
670    public String getCode() {
671        return this.code;
672    }
673
674    /**
675     *  <p>Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.</p>
676     * @return cartDiscounts
677     */
678
679    public java.util.List<com.commercetools.api.models.cart_discount.CartDiscountReference> getCartDiscounts() {
680        return this.cartDiscounts;
681    }
682
683    /**
684     *  <p>DiscountCode can only be applied to Carts that match this predicate.</p>
685     * @return cartPredicate
686     */
687
688    @Nullable
689    public String getCartPredicate() {
690        return this.cartPredicate;
691    }
692
693    /**
694     *  <p>Indicates if the DiscountCode is active and can be applied to the Cart.</p>
695     * @return isActive
696     */
697
698    public Boolean getIsActive() {
699        return this.isActive;
700    }
701
702    /**
703     *  <p>Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.</p>
704     * @return references
705     */
706
707    public java.util.List<com.commercetools.api.models.common.Reference> getReferences() {
708        return this.references;
709    }
710
711    /**
712     *  <p>Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.</p>
713     * @return maxApplications
714     */
715
716    @Nullable
717    public Long getMaxApplications() {
718        return this.maxApplications;
719    }
720
721    /**
722     *  <p>Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported). DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.</p>
723     * @return maxApplicationsPerCustomer
724     */
725
726    @Nullable
727    public Long getMaxApplicationsPerCustomer() {
728        return this.maxApplicationsPerCustomer;
729    }
730
731    /**
732     *  <p>Custom Fields of the DiscountCode.</p>
733     * @return custom
734     */
735
736    @Nullable
737    public com.commercetools.api.models.type.CustomFields getCustom() {
738        return this.custom;
739    }
740
741    /**
742     *  <p>Groups to which the DiscountCode belongs to.</p>
743     * @return groups
744     */
745
746    public java.util.List<String> getGroups() {
747        return this.groups;
748    }
749
750    /**
751     *  <p>Date and time (UTC) from which the DiscountCode is effective.</p>
752     * @return validFrom
753     */
754
755    @Nullable
756    public java.time.ZonedDateTime getValidFrom() {
757        return this.validFrom;
758    }
759
760    /**
761     *  <p>Date and time (UTC) until which the DiscountCode is effective.</p>
762     * @return validUntil
763     */
764
765    @Nullable
766    public java.time.ZonedDateTime getValidUntil() {
767        return this.validUntil;
768    }
769
770    /**
771     *  <p>Used and managed by the API and must not be used in customer logic. The value can change at any time due to internal and external factors.</p>
772     * @return applicationVersion
773     */
774
775    @Nullable
776    public Long getApplicationVersion() {
777        return this.applicationVersion;
778    }
779
780    /**
781     * builds DiscountCode with checking for non-null required values
782     * @return DiscountCode
783     */
784    public DiscountCode build() {
785        Objects.requireNonNull(id, DiscountCode.class + ": id is missing");
786        Objects.requireNonNull(version, DiscountCode.class + ": version is missing");
787        Objects.requireNonNull(createdAt, DiscountCode.class + ": createdAt is missing");
788        Objects.requireNonNull(lastModifiedAt, DiscountCode.class + ": lastModifiedAt is missing");
789        Objects.requireNonNull(code, DiscountCode.class + ": code is missing");
790        Objects.requireNonNull(cartDiscounts, DiscountCode.class + ": cartDiscounts is missing");
791        Objects.requireNonNull(isActive, DiscountCode.class + ": isActive is missing");
792        Objects.requireNonNull(references, DiscountCode.class + ": references is missing");
793        Objects.requireNonNull(groups, DiscountCode.class + ": groups is missing");
794        return new DiscountCodeImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, name,
795            description, code, cartDiscounts, cartPredicate, isActive, references, maxApplications,
796            maxApplicationsPerCustomer, custom, groups, validFrom, validUntil, applicationVersion);
797    }
798
799    /**
800     * builds DiscountCode without checking for non-null required values
801     * @return DiscountCode
802     */
803    public DiscountCode buildUnchecked() {
804        return new DiscountCodeImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, name,
805            description, code, cartDiscounts, cartPredicate, isActive, references, maxApplications,
806            maxApplicationsPerCustomer, custom, groups, validFrom, validUntil, applicationVersion);
807    }
808
809    /**
810     * factory method for an instance of DiscountCodeBuilder
811     * @return builder
812     */
813    public static DiscountCodeBuilder of() {
814        return new DiscountCodeBuilder();
815    }
816
817    /**
818     * create builder for DiscountCode instance
819     * @param template instance with prefilled values for the builder
820     * @return builder
821     */
822    public static DiscountCodeBuilder of(final DiscountCode template) {
823        DiscountCodeBuilder builder = new DiscountCodeBuilder();
824        builder.id = template.getId();
825        builder.version = template.getVersion();
826        builder.createdAt = template.getCreatedAt();
827        builder.lastModifiedAt = template.getLastModifiedAt();
828        builder.lastModifiedBy = template.getLastModifiedBy();
829        builder.createdBy = template.getCreatedBy();
830        builder.name = template.getName();
831        builder.description = template.getDescription();
832        builder.code = template.getCode();
833        builder.cartDiscounts = template.getCartDiscounts();
834        builder.cartPredicate = template.getCartPredicate();
835        builder.isActive = template.getIsActive();
836        builder.references = template.getReferences();
837        builder.maxApplications = template.getMaxApplications();
838        builder.maxApplicationsPerCustomer = template.getMaxApplicationsPerCustomer();
839        builder.custom = template.getCustom();
840        builder.groups = template.getGroups();
841        builder.validFrom = template.getValidFrom();
842        builder.validUntil = template.getValidUntil();
843        builder.applicationVersion = template.getApplicationVersion();
844        return builder;
845    }
846
847}