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.Reference;
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>Transition State on Orders.</li>
022 *   <li>Transition State on Staged Orders.</li>
023 *   <li>Transition State on Payments.</li>
024 *   <li>Transition State on Products.</li>
025 *   <li>Transition State on Quotes.</li>
026 *   <li>Transition State on Staged Quotes.</li>
027 *   <li>Transition State on Quote Requests.</li>
028 *   <li>Transition State on Reviews.</li>
029 *   <li>Transition State on States.</li>
030 *  </ul>
031 *
032 * <hr>
033 * Example to create an instance using the builder pattern
034 * <div class=code-example>
035 * <pre><code class='java'>
036 *     TransitionStateChange transitionStateChange = TransitionStateChange.builder()
037 *             .change("{change}")
038 *             .previousValue(previousValueBuilder -> previousValueBuilder)
039 *             .nextValue(nextValueBuilder -> nextValueBuilder)
040 *             .build()
041 * </code></pre>
042 * </div>
043 */
044@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
045@JsonDeserialize(as = TransitionStateChangeImpl.class)
046public interface TransitionStateChange extends Change {
047
048    /**
049     * discriminator value for TransitionStateChange
050     */
051    String TRANSITION_STATE_CHANGE = "TransitionStateChange";
052
053    /**
054     *
055     * @return type
056     */
057    @NotNull
058    @JsonProperty("type")
059    public String getType();
060
061    /**
062     *
063     * @return change
064     */
065    @NotNull
066    @JsonProperty("change")
067    public String getChange();
068
069    /**
070     *  <p>Value before the change.</p>
071     * @return previousValue
072     */
073    @NotNull
074    @Valid
075    @JsonProperty("previousValue")
076    public Reference getPreviousValue();
077
078    /**
079     *  <p>Value after the change.</p>
080     * @return nextValue
081     */
082    @NotNull
083    @Valid
084    @JsonProperty("nextValue")
085    public Reference getNextValue();
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 Reference previousValue);
100
101    /**
102     *  <p>Value after the change.</p>
103     * @param nextValue value to be set
104     */
105
106    public void setNextValue(final Reference nextValue);
107
108    /**
109     * factory method
110     * @return instance of TransitionStateChange
111     */
112    public static TransitionStateChange of() {
113        return new TransitionStateChangeImpl();
114    }
115
116    /**
117     * factory method to create a shallow copy TransitionStateChange
118     * @param template instance to be copied
119     * @return copy instance
120     */
121    public static TransitionStateChange of(final TransitionStateChange template) {
122        TransitionStateChangeImpl instance = new TransitionStateChangeImpl();
123        instance.setChange(template.getChange());
124        instance.setPreviousValue(template.getPreviousValue());
125        instance.setNextValue(template.getNextValue());
126        return instance;
127    }
128
129    /**
130     * factory method to create a deep copy of TransitionStateChange
131     * @param template instance to be copied
132     * @return copy instance
133     */
134    @Nullable
135    public static TransitionStateChange deepCopy(@Nullable final TransitionStateChange template) {
136        if (template == null) {
137            return null;
138        }
139        TransitionStateChangeImpl instance = new TransitionStateChangeImpl();
140        instance.setChange(template.getChange());
141        instance.setPreviousValue(
142            com.commercetools.history.models.common.Reference.deepCopy(template.getPreviousValue()));
143        instance.setNextValue(com.commercetools.history.models.common.Reference.deepCopy(template.getNextValue()));
144        return instance;
145    }
146
147    /**
148     * builder factory method for TransitionStateChange
149     * @return builder
150     */
151    public static TransitionStateChangeBuilder builder() {
152        return TransitionStateChangeBuilder.of();
153    }
154
155    /**
156     * create builder for TransitionStateChange instance
157     * @param template instance with prefilled values for the builder
158     * @return builder
159     */
160    public static TransitionStateChangeBuilder builder(final TransitionStateChange template) {
161        return TransitionStateChangeBuilder.of(template);
162    }
163
164    /**
165     * accessor map function
166     * @param <T> mapped type
167     * @param helper function to map the object
168     * @return mapped value
169     */
170    default <T> T withTransitionStateChange(Function<TransitionStateChange, T> helper) {
171        return helper.apply(this);
172    }
173
174    /**
175     * gives a TypeReference for usage with Jackson DataBind
176     * @return TypeReference
177     */
178    public static com.fasterxml.jackson.core.type.TypeReference<TransitionStateChange> typeReference() {
179        return new com.fasterxml.jackson.core.type.TypeReference<TransitionStateChange>() {
180            @Override
181            public String toString() {
182                return "TypeReference<TransitionStateChange>";
183            }
184        };
185    }
186}