001
002package com.commercetools.history.models.change;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007import java.util.stream.Collectors;
008
009import javax.annotation.Nullable;
010import javax.validation.Valid;
011import javax.validation.constraints.NotNull;
012
013import com.commercetools.history.models.common.Image;
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 Move image to position 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 *     MoveImageToPositionChange moveImageToPositionChange = MoveImageToPositionChange.builder()
027 *             .change("{change}")
028 *             .plusPreviousValue(previousValueBuilder -> previousValueBuilder)
029 *             .plusNextValue(nextValueBuilder -> nextValueBuilder)
030 *             .catalogData("{catalogData}")
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 = MoveImageToPositionChangeImpl.class)
037public interface MoveImageToPositionChange extends Change {
038
039    /**
040     * discriminator value for MoveImageToPositionChange
041     */
042    String MOVE_IMAGE_TO_POSITION_CHANGE = "MoveImageToPositionChange";
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 List<Image> getPreviousValue();
068
069    /**
070     *  <p>Value after the change.</p>
071     * @return nextValue
072     */
073    @NotNull
074    @Valid
075    @JsonProperty("nextValue")
076    public List<Image> getNextValue();
077
078    /**
079     *  <ul>
080     *   <li><code>staged</code>, if the staged ProductCatalogData was updated.</li>
081     *   <li><code>current</code>, if the current ProductCatalogData was updated.</li>
082     *  </ul>
083     * @return catalogData
084     */
085    @NotNull
086    @JsonProperty("catalogData")
087    public String getCatalogData();
088
089    /**
090     * set change
091     * @param change value to be set
092     */
093
094    public void setChange(final String change);
095
096    /**
097     *  <p>Value before the change.</p>
098     * @param previousValue values to be set
099     */
100
101    @JsonIgnore
102    public void setPreviousValue(final Image... previousValue);
103
104    /**
105     *  <p>Value before the change.</p>
106     * @param previousValue values to be set
107     */
108
109    public void setPreviousValue(final List<Image> previousValue);
110
111    /**
112     *  <p>Value after the change.</p>
113     * @param nextValue values to be set
114     */
115
116    @JsonIgnore
117    public void setNextValue(final Image... nextValue);
118
119    /**
120     *  <p>Value after the change.</p>
121     * @param nextValue values to be set
122     */
123
124    public void setNextValue(final List<Image> nextValue);
125
126    /**
127     *  <ul>
128     *   <li><code>staged</code>, if the staged ProductCatalogData was updated.</li>
129     *   <li><code>current</code>, if the current ProductCatalogData was updated.</li>
130     *  </ul>
131     * @param catalogData value to be set
132     */
133
134    public void setCatalogData(final String catalogData);
135
136    /**
137     * factory method
138     * @return instance of MoveImageToPositionChange
139     */
140    public static MoveImageToPositionChange of() {
141        return new MoveImageToPositionChangeImpl();
142    }
143
144    /**
145     * factory method to create a shallow copy MoveImageToPositionChange
146     * @param template instance to be copied
147     * @return copy instance
148     */
149    public static MoveImageToPositionChange of(final MoveImageToPositionChange template) {
150        MoveImageToPositionChangeImpl instance = new MoveImageToPositionChangeImpl();
151        instance.setChange(template.getChange());
152        instance.setPreviousValue(template.getPreviousValue());
153        instance.setNextValue(template.getNextValue());
154        instance.setCatalogData(template.getCatalogData());
155        return instance;
156    }
157
158    /**
159     * factory method to create a deep copy of MoveImageToPositionChange
160     * @param template instance to be copied
161     * @return copy instance
162     */
163    @Nullable
164    public static MoveImageToPositionChange deepCopy(@Nullable final MoveImageToPositionChange template) {
165        if (template == null) {
166            return null;
167        }
168        MoveImageToPositionChangeImpl instance = new MoveImageToPositionChangeImpl();
169        instance.setChange(template.getChange());
170        instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue())
171                .map(t -> t.stream()
172                        .map(com.commercetools.history.models.common.Image::deepCopy)
173                        .collect(Collectors.toList()))
174                .orElse(null));
175        instance.setNextValue(Optional.ofNullable(template.getNextValue())
176                .map(t -> t.stream()
177                        .map(com.commercetools.history.models.common.Image::deepCopy)
178                        .collect(Collectors.toList()))
179                .orElse(null));
180        instance.setCatalogData(template.getCatalogData());
181        return instance;
182    }
183
184    /**
185     * builder factory method for MoveImageToPositionChange
186     * @return builder
187     */
188    public static MoveImageToPositionChangeBuilder builder() {
189        return MoveImageToPositionChangeBuilder.of();
190    }
191
192    /**
193     * create builder for MoveImageToPositionChange instance
194     * @param template instance with prefilled values for the builder
195     * @return builder
196     */
197    public static MoveImageToPositionChangeBuilder builder(final MoveImageToPositionChange template) {
198        return MoveImageToPositionChangeBuilder.of(template);
199    }
200
201    /**
202     * accessor map function
203     * @param <T> mapped type
204     * @param helper function to map the object
205     * @return mapped value
206     */
207    default <T> T withMoveImageToPositionChange(Function<MoveImageToPositionChange, T> helper) {
208        return helper.apply(this);
209    }
210
211    /**
212     * gives a TypeReference for usage with Jackson DataBind
213     * @return TypeReference
214     */
215    public static com.fasterxml.jackson.core.type.TypeReference<MoveImageToPositionChange> typeReference() {
216        return new com.fasterxml.jackson.core.type.TypeReference<MoveImageToPositionChange>() {
217            @Override
218            public String toString() {
219                return "TypeReference<MoveImageToPositionChange>";
220            }
221        };
222    }
223}