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 * PaymentStatusStateTransitionMessageBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     PaymentStatusStateTransitionMessage paymentStatusStateTransitionMessage = PaymentStatusStateTransitionMessage.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 *             .state(stateBuilder -> stateBuilder)
027 *             .force(true)
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 PaymentStatusStateTransitionMessageBuilder implements Builder<PaymentStatusStateTransitionMessage> {
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    private Long sequenceNumber;
050
051    private com.commercetools.api.models.common.Reference resource;
052
053    private Long resourceVersion;
054
055    @Nullable
056    private com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers;
057
058    private com.commercetools.api.models.state.StateReference state;
059
060    private Boolean force;
061
062    /**
063     *  <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p>
064     * @param id value to be set
065     * @return Builder
066     */
067
068    public PaymentStatusStateTransitionMessageBuilder id(final String id) {
069        this.id = id;
070        return this;
071    }
072
073    /**
074     *  <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p>
075     * @param version value to be set
076     * @return Builder
077     */
078
079    public PaymentStatusStateTransitionMessageBuilder version(final Long version) {
080        this.version = version;
081        return this;
082    }
083
084    /**
085     *  <p>Date and time (UTC) the Message was generated.</p>
086     * @param createdAt value to be set
087     * @return Builder
088     */
089
090    public PaymentStatusStateTransitionMessageBuilder createdAt(final java.time.ZonedDateTime createdAt) {
091        this.createdAt = createdAt;
092        return this;
093    }
094
095    /**
096     *  <p>Value of <code>createdAt</code>.</p>
097     * @param lastModifiedAt value to be set
098     * @return Builder
099     */
100
101    public PaymentStatusStateTransitionMessageBuilder lastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) {
102        this.lastModifiedAt = lastModifiedAt;
103        return this;
104    }
105
106    /**
107     *  <p>Value of <code>createdBy</code>.</p>
108     * @param builder function to build the lastModifiedBy value
109     * @return Builder
110     */
111
112    public PaymentStatusStateTransitionMessageBuilder lastModifiedBy(
113            Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedByBuilder> builder) {
114        this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()).build();
115        return this;
116    }
117
118    /**
119     *  <p>Value of <code>createdBy</code>.</p>
120     * @param builder function to build the lastModifiedBy value
121     * @return Builder
122     */
123
124    public PaymentStatusStateTransitionMessageBuilder withLastModifiedBy(
125            Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedBy> builder) {
126        this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of());
127        return this;
128    }
129
130    /**
131     *  <p>Value of <code>createdBy</code>.</p>
132     * @param lastModifiedBy value to be set
133     * @return Builder
134     */
135
136    public PaymentStatusStateTransitionMessageBuilder lastModifiedBy(
137            @Nullable final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) {
138        this.lastModifiedBy = lastModifiedBy;
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 createdBy value
145     * @return Builder
146     */
147
148    public PaymentStatusStateTransitionMessageBuilder createdBy(
149            Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedByBuilder> builder) {
150        this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()).build();
151        return this;
152    }
153
154    /**
155     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
156     * @param builder function to build the createdBy value
157     * @return Builder
158     */
159
160    public PaymentStatusStateTransitionMessageBuilder withCreatedBy(
161            Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedBy> builder) {
162        this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of());
163        return this;
164    }
165
166    /**
167     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
168     * @param createdBy value to be set
169     * @return Builder
170     */
171
172    public PaymentStatusStateTransitionMessageBuilder createdBy(
173            @Nullable final com.commercetools.api.models.common.CreatedBy createdBy) {
174        this.createdBy = createdBy;
175        return this;
176    }
177
178    /**
179     *  <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>
180     * @param sequenceNumber value to be set
181     * @return Builder
182     */
183
184    public PaymentStatusStateTransitionMessageBuilder sequenceNumber(final Long sequenceNumber) {
185        this.sequenceNumber = sequenceNumber;
186        return this;
187    }
188
189    /**
190     *  <p>Reference to the resource on which the change or action was performed.</p>
191     * @param resource value to be set
192     * @return Builder
193     */
194
195    public PaymentStatusStateTransitionMessageBuilder resource(
196            final com.commercetools.api.models.common.Reference resource) {
197        this.resource = resource;
198        return this;
199    }
200
201    /**
202     *  <p>Reference to the resource on which the change or action was performed.</p>
203     * @param builder function to build the resource value
204     * @return Builder
205     */
206
207    public PaymentStatusStateTransitionMessageBuilder resource(
208            Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) {
209        this.resource = builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build();
210        return this;
211    }
212
213    /**
214     *  <p>Version of the resource on which the change or action was performed.</p>
215     * @param resourceVersion value to be set
216     * @return Builder
217     */
218
219    public PaymentStatusStateTransitionMessageBuilder resourceVersion(final Long resourceVersion) {
220        this.resourceVersion = resourceVersion;
221        return this;
222    }
223
224    /**
225     *  <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>
226     * @param builder function to build the resourceUserProvidedIdentifiers value
227     * @return Builder
228     */
229
230    public PaymentStatusStateTransitionMessageBuilder resourceUserProvidedIdentifiers(
231            Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiersBuilder> builder) {
232        this.resourceUserProvidedIdentifiers = builder
233                .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of())
234                .build();
235        return this;
236    }
237
238    /**
239     *  <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>
240     * @param builder function to build the resourceUserProvidedIdentifiers value
241     * @return Builder
242     */
243
244    public PaymentStatusStateTransitionMessageBuilder withResourceUserProvidedIdentifiers(
245            Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiers> builder) {
246        this.resourceUserProvidedIdentifiers = builder
247                .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of());
248        return this;
249    }
250
251    /**
252     *  <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>
253     * @param resourceUserProvidedIdentifiers value to be set
254     * @return Builder
255     */
256
257    public PaymentStatusStateTransitionMessageBuilder resourceUserProvidedIdentifiers(
258            @Nullable final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) {
259        this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers;
260        return this;
261    }
262
263    /**
264     *  <p>State of the Payment after the Transition State update action.</p>
265     * @param builder function to build the state value
266     * @return Builder
267     */
268
269    public PaymentStatusStateTransitionMessageBuilder state(
270            Function<com.commercetools.api.models.state.StateReferenceBuilder, com.commercetools.api.models.state.StateReferenceBuilder> builder) {
271        this.state = builder.apply(com.commercetools.api.models.state.StateReferenceBuilder.of()).build();
272        return this;
273    }
274
275    /**
276     *  <p>State of the Payment after the Transition State update action.</p>
277     * @param builder function to build the state value
278     * @return Builder
279     */
280
281    public PaymentStatusStateTransitionMessageBuilder withState(
282            Function<com.commercetools.api.models.state.StateReferenceBuilder, com.commercetools.api.models.state.StateReference> builder) {
283        this.state = builder.apply(com.commercetools.api.models.state.StateReferenceBuilder.of());
284        return this;
285    }
286
287    /**
288     *  <p>State of the Payment after the Transition State update action.</p>
289     * @param state value to be set
290     * @return Builder
291     */
292
293    public PaymentStatusStateTransitionMessageBuilder state(
294            final com.commercetools.api.models.state.StateReference state) {
295        this.state = state;
296        return this;
297    }
298
299    /**
300     *  <p>Whether State transition validations were turned off during the Change Transaction State update action.</p>
301     * @param force value to be set
302     * @return Builder
303     */
304
305    public PaymentStatusStateTransitionMessageBuilder force(final Boolean force) {
306        this.force = force;
307        return this;
308    }
309
310    /**
311     *  <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p>
312     * @return id
313     */
314
315    public String getId() {
316        return this.id;
317    }
318
319    /**
320     *  <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p>
321     * @return version
322     */
323
324    public Long getVersion() {
325        return this.version;
326    }
327
328    /**
329     *  <p>Date and time (UTC) the Message was generated.</p>
330     * @return createdAt
331     */
332
333    public java.time.ZonedDateTime getCreatedAt() {
334        return this.createdAt;
335    }
336
337    /**
338     *  <p>Value of <code>createdAt</code>.</p>
339     * @return lastModifiedAt
340     */
341
342    public java.time.ZonedDateTime getLastModifiedAt() {
343        return this.lastModifiedAt;
344    }
345
346    /**
347     *  <p>Value of <code>createdBy</code>.</p>
348     * @return lastModifiedBy
349     */
350
351    @Nullable
352    public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() {
353        return this.lastModifiedBy;
354    }
355
356    /**
357     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
358     * @return createdBy
359     */
360
361    @Nullable
362    public com.commercetools.api.models.common.CreatedBy getCreatedBy() {
363        return this.createdBy;
364    }
365
366    /**
367     *  <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>
368     * @return sequenceNumber
369     */
370
371    public Long getSequenceNumber() {
372        return this.sequenceNumber;
373    }
374
375    /**
376     *  <p>Reference to the resource on which the change or action was performed.</p>
377     * @return resource
378     */
379
380    public com.commercetools.api.models.common.Reference getResource() {
381        return this.resource;
382    }
383
384    /**
385     *  <p>Version of the resource on which the change or action was performed.</p>
386     * @return resourceVersion
387     */
388
389    public Long getResourceVersion() {
390        return this.resourceVersion;
391    }
392
393    /**
394     *  <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>
395     * @return resourceUserProvidedIdentifiers
396     */
397
398    @Nullable
399    public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() {
400        return this.resourceUserProvidedIdentifiers;
401    }
402
403    /**
404     *  <p>State of the Payment after the Transition State update action.</p>
405     * @return state
406     */
407
408    public com.commercetools.api.models.state.StateReference getState() {
409        return this.state;
410    }
411
412    /**
413     *  <p>Whether State transition validations were turned off during the Change Transaction State update action.</p>
414     * @return force
415     */
416
417    public Boolean getForce() {
418        return this.force;
419    }
420
421    /**
422     * builds PaymentStatusStateTransitionMessage with checking for non-null required values
423     * @return PaymentStatusStateTransitionMessage
424     */
425    public PaymentStatusStateTransitionMessage build() {
426        Objects.requireNonNull(id, PaymentStatusStateTransitionMessage.class + ": id is missing");
427        Objects.requireNonNull(version, PaymentStatusStateTransitionMessage.class + ": version is missing");
428        Objects.requireNonNull(createdAt, PaymentStatusStateTransitionMessage.class + ": createdAt is missing");
429        Objects.requireNonNull(lastModifiedAt,
430            PaymentStatusStateTransitionMessage.class + ": lastModifiedAt is missing");
431        Objects.requireNonNull(sequenceNumber,
432            PaymentStatusStateTransitionMessage.class + ": sequenceNumber is missing");
433        Objects.requireNonNull(resource, PaymentStatusStateTransitionMessage.class + ": resource is missing");
434        Objects.requireNonNull(resourceVersion,
435            PaymentStatusStateTransitionMessage.class + ": resourceVersion is missing");
436        Objects.requireNonNull(state, PaymentStatusStateTransitionMessage.class + ": state is missing");
437        Objects.requireNonNull(force, PaymentStatusStateTransitionMessage.class + ": force is missing");
438        return new PaymentStatusStateTransitionMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy,
439            createdBy, sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, state, force);
440    }
441
442    /**
443     * builds PaymentStatusStateTransitionMessage without checking for non-null required values
444     * @return PaymentStatusStateTransitionMessage
445     */
446    public PaymentStatusStateTransitionMessage buildUnchecked() {
447        return new PaymentStatusStateTransitionMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy,
448            createdBy, sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, state, force);
449    }
450
451    /**
452     * factory method for an instance of PaymentStatusStateTransitionMessageBuilder
453     * @return builder
454     */
455    public static PaymentStatusStateTransitionMessageBuilder of() {
456        return new PaymentStatusStateTransitionMessageBuilder();
457    }
458
459    /**
460     * create builder for PaymentStatusStateTransitionMessage instance
461     * @param template instance with prefilled values for the builder
462     * @return builder
463     */
464    public static PaymentStatusStateTransitionMessageBuilder of(final PaymentStatusStateTransitionMessage template) {
465        PaymentStatusStateTransitionMessageBuilder builder = new PaymentStatusStateTransitionMessageBuilder();
466        builder.id = template.getId();
467        builder.version = template.getVersion();
468        builder.createdAt = template.getCreatedAt();
469        builder.lastModifiedAt = template.getLastModifiedAt();
470        builder.lastModifiedBy = template.getLastModifiedBy();
471        builder.createdBy = template.getCreatedBy();
472        builder.sequenceNumber = template.getSequenceNumber();
473        builder.resource = template.getResource();
474        builder.resourceVersion = template.getResourceVersion();
475        builder.resourceUserProvidedIdentifiers = template.getResourceUserProvidedIdentifiers();
476        builder.state = template.getState();
477        builder.force = template.getForce();
478        return builder;
479    }
480
481}