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.CustomFields;
013import com.commercetools.history.models.common.LocalizedString;
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 following update actions:</p>
021 *  <ul>
022 *   <li>Set LineItem Custom Type on Orders.</li>
023 *   <li>Set LineItem Custom Type on Staged Orders.</li>
024 *  </ul>
025 *
026 * <hr>
027 * Example to create an instance using the builder pattern
028 * <div class=code-example>
029 * <pre><code class='java'>
030 *     SetOrderLineItemCustomTypeChange setOrderLineItemCustomTypeChange = SetOrderLineItemCustomTypeChange.builder()
031 *             .change("{change}")
032 *             .previousValue(previousValueBuilder -> previousValueBuilder)
033 *             .nextValue(nextValueBuilder -> nextValueBuilder)
034 *             .lineItem(lineItemBuilder -> lineItemBuilder)
035 *             .variant("{variant}")
036 *             .build()
037 * </code></pre>
038 * </div>
039 */
040@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
041@JsonDeserialize(as = SetOrderLineItemCustomTypeChangeImpl.class)
042public interface SetOrderLineItemCustomTypeChange extends Change {
043
044    /**
045     * discriminator value for SetOrderLineItemCustomTypeChange
046     */
047    String SET_ORDER_LINE_ITEM_CUSTOM_TYPE_CHANGE = "SetOrderLineItemCustomTypeChange";
048
049    /**
050     *
051     * @return type
052     */
053    @NotNull
054    @JsonProperty("type")
055    public String getType();
056
057    /**
058     *
059     * @return change
060     */
061    @NotNull
062    @JsonProperty("change")
063    public String getChange();
064
065    /**
066     *  <p>Value before the change.</p>
067     * @return previousValue
068     */
069    @NotNull
070    @Valid
071    @JsonProperty("previousValue")
072    public CustomFields getPreviousValue();
073
074    /**
075     *  <p>Value after the change.</p>
076     * @return nextValue
077     */
078    @NotNull
079    @Valid
080    @JsonProperty("nextValue")
081    public CustomFields getNextValue();
082
083    /**
084     *  <p>Name of the Product the updated Line Item is based on.</p>
085     * @return lineItem
086     */
087    @NotNull
088    @Valid
089    @JsonProperty("lineItem")
090    public LocalizedString getLineItem();
091
092    /**
093     *  <p><code>sku</code> or <code>key</code> of the ProductVariant.</p>
094     * @return variant
095     */
096    @NotNull
097    @JsonProperty("variant")
098    public String getVariant();
099
100    /**
101     * set change
102     * @param change value to be set
103     */
104
105    public void setChange(final String change);
106
107    /**
108     *  <p>Value before the change.</p>
109     * @param previousValue value to be set
110     */
111
112    public void setPreviousValue(final CustomFields previousValue);
113
114    /**
115     *  <p>Value after the change.</p>
116     * @param nextValue value to be set
117     */
118
119    public void setNextValue(final CustomFields nextValue);
120
121    /**
122     *  <p>Name of the Product the updated Line Item is based on.</p>
123     * @param lineItem value to be set
124     */
125
126    public void setLineItem(final LocalizedString lineItem);
127
128    /**
129     *  <p><code>sku</code> or <code>key</code> of the ProductVariant.</p>
130     * @param variant value to be set
131     */
132
133    public void setVariant(final String variant);
134
135    /**
136     * factory method
137     * @return instance of SetOrderLineItemCustomTypeChange
138     */
139    public static SetOrderLineItemCustomTypeChange of() {
140        return new SetOrderLineItemCustomTypeChangeImpl();
141    }
142
143    /**
144     * factory method to create a shallow copy SetOrderLineItemCustomTypeChange
145     * @param template instance to be copied
146     * @return copy instance
147     */
148    public static SetOrderLineItemCustomTypeChange of(final SetOrderLineItemCustomTypeChange template) {
149        SetOrderLineItemCustomTypeChangeImpl instance = new SetOrderLineItemCustomTypeChangeImpl();
150        instance.setChange(template.getChange());
151        instance.setPreviousValue(template.getPreviousValue());
152        instance.setNextValue(template.getNextValue());
153        instance.setLineItem(template.getLineItem());
154        instance.setVariant(template.getVariant());
155        return instance;
156    }
157
158    /**
159     * factory method to create a deep copy of SetOrderLineItemCustomTypeChange
160     * @param template instance to be copied
161     * @return copy instance
162     */
163    @Nullable
164    public static SetOrderLineItemCustomTypeChange deepCopy(@Nullable final SetOrderLineItemCustomTypeChange template) {
165        if (template == null) {
166            return null;
167        }
168        SetOrderLineItemCustomTypeChangeImpl instance = new SetOrderLineItemCustomTypeChangeImpl();
169        instance.setChange(template.getChange());
170        instance.setPreviousValue(
171            com.commercetools.history.models.common.CustomFields.deepCopy(template.getPreviousValue()));
172        instance.setNextValue(com.commercetools.history.models.common.CustomFields.deepCopy(template.getNextValue()));
173        instance.setLineItem(com.commercetools.history.models.common.LocalizedString.deepCopy(template.getLineItem()));
174        instance.setVariant(template.getVariant());
175        return instance;
176    }
177
178    /**
179     * builder factory method for SetOrderLineItemCustomTypeChange
180     * @return builder
181     */
182    public static SetOrderLineItemCustomTypeChangeBuilder builder() {
183        return SetOrderLineItemCustomTypeChangeBuilder.of();
184    }
185
186    /**
187     * create builder for SetOrderLineItemCustomTypeChange instance
188     * @param template instance with prefilled values for the builder
189     * @return builder
190     */
191    public static SetOrderLineItemCustomTypeChangeBuilder builder(final SetOrderLineItemCustomTypeChange template) {
192        return SetOrderLineItemCustomTypeChangeBuilder.of(template);
193    }
194
195    /**
196     * accessor map function
197     * @param <T> mapped type
198     * @param helper function to map the object
199     * @return mapped value
200     */
201    default <T> T withSetOrderLineItemCustomTypeChange(Function<SetOrderLineItemCustomTypeChange, T> helper) {
202        return helper.apply(this);
203    }
204
205    /**
206     * gives a TypeReference for usage with Jackson DataBind
207     * @return TypeReference
208     */
209    public static com.fasterxml.jackson.core.type.TypeReference<SetOrderLineItemCustomTypeChange> typeReference() {
210        return new com.fasterxml.jackson.core.type.TypeReference<SetOrderLineItemCustomTypeChange>() {
211            @Override
212            public String toString() {
213                return "TypeReference<SetOrderLineItemCustomTypeChange>";
214            }
215        };
216    }
217}