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