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