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 * CustomerEmailChangedMessageBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     CustomerEmailChangedMessage customerEmailChangedMessage = CustomerEmailChangedMessage.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 *             .email("{email}")
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 CustomerEmailChangedMessageBuilder implements Builder<CustomerEmailChangedMessage> {
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 String email;
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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder 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 CustomerEmailChangedMessageBuilder resource(final com.commercetools.api.models.common.Reference resource) {
193        this.resource = resource;
194        return this;
195    }
196
197    /**
198     *  <p>Reference to the resource on which the change or action was performed.</p>
199     * @param builder function to build the resource value
200     * @return Builder
201     */
202
203    public CustomerEmailChangedMessageBuilder resource(
204            Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) {
205        this.resource = builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build();
206        return this;
207    }
208
209    /**
210     *  <p>Version of the resource on which the change or action was performed.</p>
211     * @param resourceVersion value to be set
212     * @return Builder
213     */
214
215    public CustomerEmailChangedMessageBuilder resourceVersion(final Long resourceVersion) {
216        this.resourceVersion = resourceVersion;
217        return this;
218    }
219
220    /**
221     *  <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>
222     * @param builder function to build the resourceUserProvidedIdentifiers value
223     * @return Builder
224     */
225
226    public CustomerEmailChangedMessageBuilder resourceUserProvidedIdentifiers(
227            Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiersBuilder> builder) {
228        this.resourceUserProvidedIdentifiers = builder
229                .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of())
230                .build();
231        return this;
232    }
233
234    /**
235     *  <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>
236     * @param builder function to build the resourceUserProvidedIdentifiers value
237     * @return Builder
238     */
239
240    public CustomerEmailChangedMessageBuilder withResourceUserProvidedIdentifiers(
241            Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiers> builder) {
242        this.resourceUserProvidedIdentifiers = builder
243                .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of());
244        return this;
245    }
246
247    /**
248     *  <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>
249     * @param resourceUserProvidedIdentifiers value to be set
250     * @return Builder
251     */
252
253    public CustomerEmailChangedMessageBuilder resourceUserProvidedIdentifiers(
254            @Nullable final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) {
255        this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers;
256        return this;
257    }
258
259    /**
260     *  <p>The <code>email</code> that was set during the Change Email update action.</p>
261     * @param email value to be set
262     * @return Builder
263     */
264
265    public CustomerEmailChangedMessageBuilder email(final String email) {
266        this.email = email;
267        return this;
268    }
269
270    /**
271     *  <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p>
272     * @return id
273     */
274
275    public String getId() {
276        return this.id;
277    }
278
279    /**
280     *  <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p>
281     * @return version
282     */
283
284    public Long getVersion() {
285        return this.version;
286    }
287
288    /**
289     *  <p>Date and time (UTC) the Message was generated.</p>
290     * @return createdAt
291     */
292
293    public java.time.ZonedDateTime getCreatedAt() {
294        return this.createdAt;
295    }
296
297    /**
298     *  <p>Value of <code>createdAt</code>.</p>
299     * @return lastModifiedAt
300     */
301
302    public java.time.ZonedDateTime getLastModifiedAt() {
303        return this.lastModifiedAt;
304    }
305
306    /**
307     *  <p>Value of <code>createdBy</code>.</p>
308     * @return lastModifiedBy
309     */
310
311    @Nullable
312    public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() {
313        return this.lastModifiedBy;
314    }
315
316    /**
317     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
318     * @return createdBy
319     */
320
321    @Nullable
322    public com.commercetools.api.models.common.CreatedBy getCreatedBy() {
323        return this.createdBy;
324    }
325
326    /**
327     *  <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>
328     * @return sequenceNumber
329     */
330
331    public Long getSequenceNumber() {
332        return this.sequenceNumber;
333    }
334
335    /**
336     *  <p>Reference to the resource on which the change or action was performed.</p>
337     * @return resource
338     */
339
340    public com.commercetools.api.models.common.Reference getResource() {
341        return this.resource;
342    }
343
344    /**
345     *  <p>Version of the resource on which the change or action was performed.</p>
346     * @return resourceVersion
347     */
348
349    public Long getResourceVersion() {
350        return this.resourceVersion;
351    }
352
353    /**
354     *  <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>
355     * @return resourceUserProvidedIdentifiers
356     */
357
358    @Nullable
359    public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() {
360        return this.resourceUserProvidedIdentifiers;
361    }
362
363    /**
364     *  <p>The <code>email</code> that was set during the Change Email update action.</p>
365     * @return email
366     */
367
368    public String getEmail() {
369        return this.email;
370    }
371
372    /**
373     * builds CustomerEmailChangedMessage with checking for non-null required values
374     * @return CustomerEmailChangedMessage
375     */
376    public CustomerEmailChangedMessage build() {
377        Objects.requireNonNull(id, CustomerEmailChangedMessage.class + ": id is missing");
378        Objects.requireNonNull(version, CustomerEmailChangedMessage.class + ": version is missing");
379        Objects.requireNonNull(createdAt, CustomerEmailChangedMessage.class + ": createdAt is missing");
380        Objects.requireNonNull(lastModifiedAt, CustomerEmailChangedMessage.class + ": lastModifiedAt is missing");
381        Objects.requireNonNull(sequenceNumber, CustomerEmailChangedMessage.class + ": sequenceNumber is missing");
382        Objects.requireNonNull(resource, CustomerEmailChangedMessage.class + ": resource is missing");
383        Objects.requireNonNull(resourceVersion, CustomerEmailChangedMessage.class + ": resourceVersion is missing");
384        Objects.requireNonNull(email, CustomerEmailChangedMessage.class + ": email is missing");
385        return new CustomerEmailChangedMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy,
386            sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, email);
387    }
388
389    /**
390     * builds CustomerEmailChangedMessage without checking for non-null required values
391     * @return CustomerEmailChangedMessage
392     */
393    public CustomerEmailChangedMessage buildUnchecked() {
394        return new CustomerEmailChangedMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy,
395            sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, email);
396    }
397
398    /**
399     * factory method for an instance of CustomerEmailChangedMessageBuilder
400     * @return builder
401     */
402    public static CustomerEmailChangedMessageBuilder of() {
403        return new CustomerEmailChangedMessageBuilder();
404    }
405
406    /**
407     * create builder for CustomerEmailChangedMessage instance
408     * @param template instance with prefilled values for the builder
409     * @return builder
410     */
411    public static CustomerEmailChangedMessageBuilder of(final CustomerEmailChangedMessage template) {
412        CustomerEmailChangedMessageBuilder builder = new CustomerEmailChangedMessageBuilder();
413        builder.id = template.getId();
414        builder.version = template.getVersion();
415        builder.createdAt = template.getCreatedAt();
416        builder.lastModifiedAt = template.getLastModifiedAt();
417        builder.lastModifiedBy = template.getLastModifiedBy();
418        builder.createdBy = template.getCreatedBy();
419        builder.sequenceNumber = template.getSequenceNumber();
420        builder.resource = template.getResource();
421        builder.resourceVersion = template.getResourceVersion();
422        builder.resourceUserProvidedIdentifiers = template.getResourceUserProvidedIdentifiers();
423        builder.email = template.getEmail();
424        return builder;
425    }
426
427}