001
002package com.commercetools.history.models.change;
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.history.models.common.ProductVariantSelection;
013import com.commercetools.history.models.common.Reference;
014import com.fasterxml.jackson.annotation.*;
015import com.fasterxml.jackson.databind.annotation.*;
016
017import io.vrap.rmf.base.client.utils.Generated;
018
019/**
020 *  <p>Change triggered by the Add Product 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 *     AddProductChange addProductChange = AddProductChange.builder()
027 *             .change("{change}")
028 *             .nextValue(nextValueBuilder -> nextValueBuilder)
029 *             .variantSelection(variantSelectionBuilder -> variantSelectionBuilder)
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 = AddProductChangeImpl.class)
036public interface AddProductChange extends Change {
037
038    /**
039     * discriminator value for AddProductChange
040     */
041    String ADD_PRODUCT_CHANGE = "AddProductChange";
042
043    /**
044     *
045     * @return type
046     */
047    @NotNull
048    @JsonProperty("type")
049    public String getType();
050
051    /**
052     *
053     * @return change
054     */
055    @NotNull
056    @JsonProperty("change")
057    public String getChange();
058
059    /**
060     *  <p>Value after the change.</p>
061     * @return nextValue
062     */
063    @NotNull
064    @Valid
065    @JsonProperty("nextValue")
066    public Reference getNextValue();
067
068    /**
069     *  <p>The Product Variants included in the Product Selection.</p>
070     * @return variantSelection
071     */
072    @NotNull
073    @Valid
074    @JsonProperty("variantSelection")
075    public ProductVariantSelection getVariantSelection();
076
077    /**
078     * set change
079     * @param change value to be set
080     */
081
082    public void setChange(final String change);
083
084    /**
085     *  <p>Value after the change.</p>
086     * @param nextValue value to be set
087     */
088
089    public void setNextValue(final Reference nextValue);
090
091    /**
092     *  <p>The Product Variants included in the Product Selection.</p>
093     * @param variantSelection value to be set
094     */
095
096    public void setVariantSelection(final ProductVariantSelection variantSelection);
097
098    /**
099     * factory method
100     * @return instance of AddProductChange
101     */
102    public static AddProductChange of() {
103        return new AddProductChangeImpl();
104    }
105
106    /**
107     * factory method to create a shallow copy AddProductChange
108     * @param template instance to be copied
109     * @return copy instance
110     */
111    public static AddProductChange of(final AddProductChange template) {
112        AddProductChangeImpl instance = new AddProductChangeImpl();
113        instance.setChange(template.getChange());
114        instance.setNextValue(template.getNextValue());
115        instance.setVariantSelection(template.getVariantSelection());
116        return instance;
117    }
118
119    /**
120     * factory method to create a deep copy of AddProductChange
121     * @param template instance to be copied
122     * @return copy instance
123     */
124    @Nullable
125    public static AddProductChange deepCopy(@Nullable final AddProductChange template) {
126        if (template == null) {
127            return null;
128        }
129        AddProductChangeImpl instance = new AddProductChangeImpl();
130        instance.setChange(template.getChange());
131        instance.setNextValue(com.commercetools.history.models.common.Reference.deepCopy(template.getNextValue()));
132        instance.setVariantSelection(
133            com.commercetools.history.models.common.ProductVariantSelection.deepCopy(template.getVariantSelection()));
134        return instance;
135    }
136
137    /**
138     * builder factory method for AddProductChange
139     * @return builder
140     */
141    public static AddProductChangeBuilder builder() {
142        return AddProductChangeBuilder.of();
143    }
144
145    /**
146     * create builder for AddProductChange instance
147     * @param template instance with prefilled values for the builder
148     * @return builder
149     */
150    public static AddProductChangeBuilder builder(final AddProductChange template) {
151        return AddProductChangeBuilder.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 withAddProductChange(Function<AddProductChange, 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<AddProductChange> typeReference() {
169        return new com.fasterxml.jackson.core.type.TypeReference<AddProductChange>() {
170            @Override
171            public String toString() {
172                return "TypeReference<AddProductChange>";
173            }
174        };
175    }
176}