001
002package com.commercetools.api.models.message;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010import javax.validation.constraints.NotNull;
011
012import com.commercetools.api.models.product_selection.ProductSelection;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 *  <p>Generated after a successful Create Product Selection request.</p>
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     ProductSelectionCreatedMessage productSelectionCreatedMessage = ProductSelectionCreatedMessage.builder()
026 *             .id("{id}")
027 *             .version(0.3)
028 *             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
029 *             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
030 *             .sequenceNumber(0.3)
031 *             .resource(resourceBuilder -> resourceBuilder)
032 *             .resourceVersion(0.3)
033 *             .productSelection(productSelectionBuilder -> productSelectionBuilder)
034 *             .build()
035 * </code></pre>
036 * </div>
037 */
038@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
039@JsonDeserialize(as = ProductSelectionCreatedMessageImpl.class)
040public interface ProductSelectionCreatedMessage extends Message {
041
042    /**
043     * discriminator value for ProductSelectionCreatedMessage
044     */
045    String PRODUCT_SELECTION_CREATED = "ProductSelectionCreated";
046
047    /**
048     *  <p>Product Selection that was created.</p>
049     * @return productSelection
050     */
051    @NotNull
052    @Valid
053    @JsonProperty("productSelection")
054    public ProductSelection getProductSelection();
055
056    /**
057     *  <p>Product Selection that was created.</p>
058     * @param productSelection value to be set
059     */
060
061    public void setProductSelection(final ProductSelection productSelection);
062
063    /**
064     * factory method
065     * @return instance of ProductSelectionCreatedMessage
066     */
067    public static ProductSelectionCreatedMessage of() {
068        return new ProductSelectionCreatedMessageImpl();
069    }
070
071    /**
072     * factory method to create a shallow copy ProductSelectionCreatedMessage
073     * @param template instance to be copied
074     * @return copy instance
075     */
076    public static ProductSelectionCreatedMessage of(final ProductSelectionCreatedMessage template) {
077        ProductSelectionCreatedMessageImpl instance = new ProductSelectionCreatedMessageImpl();
078        instance.setId(template.getId());
079        instance.setVersion(template.getVersion());
080        instance.setCreatedAt(template.getCreatedAt());
081        instance.setLastModifiedAt(template.getLastModifiedAt());
082        instance.setLastModifiedBy(template.getLastModifiedBy());
083        instance.setCreatedBy(template.getCreatedBy());
084        instance.setSequenceNumber(template.getSequenceNumber());
085        instance.setResource(template.getResource());
086        instance.setResourceVersion(template.getResourceVersion());
087        instance.setResourceUserProvidedIdentifiers(template.getResourceUserProvidedIdentifiers());
088        instance.setProductSelection(template.getProductSelection());
089        return instance;
090    }
091
092    /**
093     * factory method to create a deep copy of ProductSelectionCreatedMessage
094     * @param template instance to be copied
095     * @return copy instance
096     */
097    @Nullable
098    public static ProductSelectionCreatedMessage deepCopy(@Nullable final ProductSelectionCreatedMessage template) {
099        if (template == null) {
100            return null;
101        }
102        ProductSelectionCreatedMessageImpl instance = new ProductSelectionCreatedMessageImpl();
103        instance.setId(template.getId());
104        instance.setVersion(template.getVersion());
105        instance.setCreatedAt(template.getCreatedAt());
106        instance.setLastModifiedAt(template.getLastModifiedAt());
107        instance.setLastModifiedBy(
108            com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy()));
109        instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy()));
110        instance.setSequenceNumber(template.getSequenceNumber());
111        instance.setResource(com.commercetools.api.models.common.Reference.deepCopy(template.getResource()));
112        instance.setResourceVersion(template.getResourceVersion());
113        instance.setResourceUserProvidedIdentifiers(com.commercetools.api.models.message.UserProvidedIdentifiers
114                .deepCopy(template.getResourceUserProvidedIdentifiers()));
115        instance.setProductSelection(
116            com.commercetools.api.models.product_selection.ProductSelection.deepCopy(template.getProductSelection()));
117        return instance;
118    }
119
120    /**
121     * builder factory method for ProductSelectionCreatedMessage
122     * @return builder
123     */
124    public static ProductSelectionCreatedMessageBuilder builder() {
125        return ProductSelectionCreatedMessageBuilder.of();
126    }
127
128    /**
129     * create builder for ProductSelectionCreatedMessage instance
130     * @param template instance with prefilled values for the builder
131     * @return builder
132     */
133    public static ProductSelectionCreatedMessageBuilder builder(final ProductSelectionCreatedMessage template) {
134        return ProductSelectionCreatedMessageBuilder.of(template);
135    }
136
137    /**
138     * accessor map function
139     * @param <T> mapped type
140     * @param helper function to map the object
141     * @return mapped value
142     */
143    default <T> T withProductSelectionCreatedMessage(Function<ProductSelectionCreatedMessage, T> helper) {
144        return helper.apply(this);
145    }
146
147    /**
148     * gives a TypeReference for usage with Jackson DataBind
149     * @return TypeReference
150     */
151    public static com.fasterxml.jackson.core.type.TypeReference<ProductSelectionCreatedMessage> typeReference() {
152        return new com.fasterxml.jackson.core.type.TypeReference<ProductSelectionCreatedMessage>() {
153            @Override
154            public String toString() {
155                return "TypeReference<ProductSelectionCreatedMessage>";
156            }
157        };
158    }
159}