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