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.constraints.NotNull;
010
011import com.commercetools.history.models.common.StateRole;
012import com.fasterxml.jackson.annotation.*;
013import com.fasterxml.jackson.databind.annotation.*;
014
015import io.vrap.rmf.base.client.utils.Generated;
016
017/**
018 *  <p>Change triggered by the Remove State roles update action.</p>
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     RemoveStateRolesChange removeStateRolesChange = RemoveStateRolesChange.builder()
025 *             .change("{change}")
026 *             .plusPreviousValue(previousValueBuilder -> previousValueBuilder)
027 *             .plusNextValue(nextValueBuilder -> nextValueBuilder)
028 *             .build()
029 * </code></pre>
030 * </div>
031 */
032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
033@JsonDeserialize(as = RemoveStateRolesChangeImpl.class)
034public interface RemoveStateRolesChange extends Change {
035
036    /**
037     * discriminator value for RemoveStateRolesChange
038     */
039    String REMOVE_STATE_ROLES_CHANGE = "RemoveStateRolesChange";
040
041    /**
042     *
043     * @return type
044     */
045    @NotNull
046    @JsonProperty("type")
047    public String getType();
048
049    /**
050     *
051     * @return change
052     */
053    @NotNull
054    @JsonProperty("change")
055    public String getChange();
056
057    /**
058     *  <p>Value before the change.</p>
059     * @return previousValue
060     */
061    @NotNull
062    @JsonProperty("previousValue")
063    public List<StateRole> getPreviousValue();
064
065    /**
066     *  <p>Value after the change.</p>
067     * @return nextValue
068     */
069    @NotNull
070    @JsonProperty("nextValue")
071    public List<StateRole> getNextValue();
072
073    /**
074     * set change
075     * @param change value to be set
076     */
077
078    public void setChange(final String change);
079
080    /**
081     *  <p>Value before the change.</p>
082     * @param previousValue values to be set
083     */
084
085    @JsonIgnore
086    public void setPreviousValue(final StateRole... previousValue);
087
088    /**
089     *  <p>Value before the change.</p>
090     * @param previousValue values to be set
091     */
092
093    public void setPreviousValue(final List<StateRole> previousValue);
094
095    /**
096     *  <p>Value after the change.</p>
097     * @param nextValue values to be set
098     */
099
100    @JsonIgnore
101    public void setNextValue(final StateRole... nextValue);
102
103    /**
104     *  <p>Value after the change.</p>
105     * @param nextValue values to be set
106     */
107
108    public void setNextValue(final List<StateRole> nextValue);
109
110    /**
111     * factory method
112     * @return instance of RemoveStateRolesChange
113     */
114    public static RemoveStateRolesChange of() {
115        return new RemoveStateRolesChangeImpl();
116    }
117
118    /**
119     * factory method to create a shallow copy RemoveStateRolesChange
120     * @param template instance to be copied
121     * @return copy instance
122     */
123    public static RemoveStateRolesChange of(final RemoveStateRolesChange template) {
124        RemoveStateRolesChangeImpl instance = new RemoveStateRolesChangeImpl();
125        instance.setChange(template.getChange());
126        instance.setPreviousValue(template.getPreviousValue());
127        instance.setNextValue(template.getNextValue());
128        return instance;
129    }
130
131    /**
132     * factory method to create a deep copy of RemoveStateRolesChange
133     * @param template instance to be copied
134     * @return copy instance
135     */
136    @Nullable
137    public static RemoveStateRolesChange deepCopy(@Nullable final RemoveStateRolesChange template) {
138        if (template == null) {
139            return null;
140        }
141        RemoveStateRolesChangeImpl instance = new RemoveStateRolesChangeImpl();
142        instance.setChange(template.getChange());
143        instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue()).map(ArrayList::new).orElse(null));
144        instance.setNextValue(Optional.ofNullable(template.getNextValue()).map(ArrayList::new).orElse(null));
145        return instance;
146    }
147
148    /**
149     * builder factory method for RemoveStateRolesChange
150     * @return builder
151     */
152    public static RemoveStateRolesChangeBuilder builder() {
153        return RemoveStateRolesChangeBuilder.of();
154    }
155
156    /**
157     * create builder for RemoveStateRolesChange instance
158     * @param template instance with prefilled values for the builder
159     * @return builder
160     */
161    public static RemoveStateRolesChangeBuilder builder(final RemoveStateRolesChange template) {
162        return RemoveStateRolesChangeBuilder.of(template);
163    }
164
165    /**
166     * accessor map function
167     * @param <T> mapped type
168     * @param helper function to map the object
169     * @return mapped value
170     */
171    default <T> T withRemoveStateRolesChange(Function<RemoveStateRolesChange, T> helper) {
172        return helper.apply(this);
173    }
174
175    /**
176     * gives a TypeReference for usage with Jackson DataBind
177     * @return TypeReference
178     */
179    public static com.fasterxml.jackson.core.type.TypeReference<RemoveStateRolesChange> typeReference() {
180        return new com.fasterxml.jackson.core.type.TypeReference<RemoveStateRolesChange>() {
181            @Override
182            public String toString() {
183                return "TypeReference<RemoveStateRolesChange>";
184            }
185        };
186    }
187}