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.cart.ProductPublishScope;
013import com.commercetools.api.models.product.ProductProjection;
014import com.fasterxml.jackson.annotation.*;
015import com.fasterxml.jackson.databind.annotation.*;
016
017import io.vrap.rmf.base.client.utils.Generated;
018
019/**
020 *  <p>Generated after a successful Publish update action.</p>
021 *
022 * <hr>
023 * Example to create an instance using the builder pattern
024 * <div class=code-example>
025 * <pre><code class='java'>
026 *     ProductPublishedMessagePayload productPublishedMessagePayload = ProductPublishedMessagePayload.builder()
027 *             .plusRemovedImageUrls(removedImageUrlsBuilder -> removedImageUrlsBuilder)
028 *             .productProjection(productProjectionBuilder -> productProjectionBuilder)
029 *             .scope(ProductPublishScope.ALL)
030 *             .build()
031 * </code></pre>
032 * </div>
033 */
034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
035@JsonDeserialize(as = ProductPublishedMessagePayloadImpl.class)
036public interface ProductPublishedMessagePayload extends MessagePayload {
037
038    /**
039     * discriminator value for ProductPublishedMessagePayload
040     */
041    String PRODUCT_PUBLISHED = "ProductPublished";
042
043    /**
044     *  <p>List of image URLs which were removed during the Publish update action.</p>
045     * @return removedImageUrls
046     */
047    @NotNull
048    @JsonProperty("removedImageUrls")
049    public List<String> getRemovedImageUrls();
050
051    /**
052     *  <p>Current Product Projection of the Product at the time of creation.</p>
053     * @return productProjection
054     */
055    @NotNull
056    @Valid
057    @JsonProperty("productProjection")
058    public ProductProjection getProductProjection();
059
060    /**
061     *  <p>Publishing Scope that was used during the Publish update action.</p>
062     * @return scope
063     */
064    @NotNull
065    @JsonProperty("scope")
066    public ProductPublishScope getScope();
067
068    /**
069     *  <p>List of image URLs which were removed during the Publish update action.</p>
070     * @param removedImageUrls values to be set
071     */
072
073    @JsonIgnore
074    public void setRemovedImageUrls(final String... removedImageUrls);
075
076    /**
077     *  <p>List of image URLs which were removed during the Publish update action.</p>
078     * @param removedImageUrls values to be set
079     */
080
081    public void setRemovedImageUrls(final List<String> removedImageUrls);
082
083    /**
084     *  <p>Current Product Projection of the Product at the time of creation.</p>
085     * @param productProjection value to be set
086     */
087
088    public void setProductProjection(final ProductProjection productProjection);
089
090    /**
091     *  <p>Publishing Scope that was used during the Publish update action.</p>
092     * @param scope value to be set
093     */
094
095    public void setScope(final ProductPublishScope scope);
096
097    /**
098     * factory method
099     * @return instance of ProductPublishedMessagePayload
100     */
101    public static ProductPublishedMessagePayload of() {
102        return new ProductPublishedMessagePayloadImpl();
103    }
104
105    /**
106     * factory method to create a shallow copy ProductPublishedMessagePayload
107     * @param template instance to be copied
108     * @return copy instance
109     */
110    public static ProductPublishedMessagePayload of(final ProductPublishedMessagePayload template) {
111        ProductPublishedMessagePayloadImpl instance = new ProductPublishedMessagePayloadImpl();
112        instance.setRemovedImageUrls(template.getRemovedImageUrls());
113        instance.setProductProjection(template.getProductProjection());
114        instance.setScope(template.getScope());
115        return instance;
116    }
117
118    /**
119     * factory method to create a deep copy of ProductPublishedMessagePayload
120     * @param template instance to be copied
121     * @return copy instance
122     */
123    @Nullable
124    public static ProductPublishedMessagePayload deepCopy(@Nullable final ProductPublishedMessagePayload template) {
125        if (template == null) {
126            return null;
127        }
128        ProductPublishedMessagePayloadImpl instance = new ProductPublishedMessagePayloadImpl();
129        instance.setRemovedImageUrls(
130            Optional.ofNullable(template.getRemovedImageUrls()).map(ArrayList::new).orElse(null));
131        instance.setProductProjection(
132            com.commercetools.api.models.product.ProductProjection.deepCopy(template.getProductProjection()));
133        instance.setScope(template.getScope());
134        return instance;
135    }
136
137    /**
138     * builder factory method for ProductPublishedMessagePayload
139     * @return builder
140     */
141    public static ProductPublishedMessagePayloadBuilder builder() {
142        return ProductPublishedMessagePayloadBuilder.of();
143    }
144
145    /**
146     * create builder for ProductPublishedMessagePayload instance
147     * @param template instance with prefilled values for the builder
148     * @return builder
149     */
150    public static ProductPublishedMessagePayloadBuilder builder(final ProductPublishedMessagePayload template) {
151        return ProductPublishedMessagePayloadBuilder.of(template);
152    }
153
154    /**
155     * accessor map function
156     * @param <T> mapped type
157     * @param helper function to map the object
158     * @return mapped value
159     */
160    default <T> T withProductPublishedMessagePayload(Function<ProductPublishedMessagePayload, T> helper) {
161        return helper.apply(this);
162    }
163
164    /**
165     * gives a TypeReference for usage with Jackson DataBind
166     * @return TypeReference
167     */
168    public static com.fasterxml.jackson.core.type.TypeReference<ProductPublishedMessagePayload> typeReference() {
169        return new com.fasterxml.jackson.core.type.TypeReference<ProductPublishedMessagePayload>() {
170            @Override
171            public String toString() {
172                return "TypeReference<ProductPublishedMessagePayload>";
173            }
174        };
175    }
176}