001
002package com.commercetools.api.models.message;
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.api.models.common.Money;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 *  <p>Generated after a successful Change Value update action.</p>
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     StandalonePriceValueChangedMessage standalonePriceValueChangedMessage = StandalonePriceValueChangedMessage.builder()
026 *             .id("{id}")
027 *             .version(0.3)
028 *             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
029 *             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
030 *             .sequenceNumber(0.3)
031 *             .resource(resourceBuilder -> resourceBuilder)
032 *             .resourceVersion(0.3)
033 *             .value(valueBuilder -> valueBuilder)
034 *             .staged(true)
035 *             .build()
036 * </code></pre>
037 * </div>
038 */
039@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
040@JsonDeserialize(as = StandalonePriceValueChangedMessageImpl.class)
041public interface StandalonePriceValueChangedMessage extends Message {
042
043    /**
044     * discriminator value for StandalonePriceValueChangedMessage
045     */
046    String STANDALONE_PRICE_VALUE_CHANGED = "StandalonePriceValueChanged";
047
048    /**
049     *  <p>The new value of the updated StandalonePrice.</p>
050     * @return value
051     */
052    @NotNull
053    @Valid
054    @JsonProperty("value")
055    public Money getValue();
056
057    /**
058     *  <p>Whether the new value was applied to the current or the staged representation of the StandalonePrice. Staged changes are stored on the StagedStandalonePrice.</p>
059     * @return staged
060     */
061    @NotNull
062    @JsonProperty("staged")
063    public Boolean getStaged();
064
065    /**
066     *  <p>The old value of the updated StandalonePrice. Present on Messages created after 3 February 2023. Optional for backwards compatibility.</p>
067     * @return oldValue
068     */
069    @Valid
070    @JsonProperty("oldValue")
071    public Money getOldValue();
072
073    /**
074     *  <p>The new value of the updated StandalonePrice.</p>
075     * @param value value to be set
076     */
077
078    public void setValue(final Money value);
079
080    /**
081     *  <p>Whether the new value was applied to the current or the staged representation of the StandalonePrice. Staged changes are stored on the StagedStandalonePrice.</p>
082     * @param staged value to be set
083     */
084
085    public void setStaged(final Boolean staged);
086
087    /**
088     *  <p>The old value of the updated StandalonePrice. Present on Messages created after 3 February 2023. Optional for backwards compatibility.</p>
089     * @param oldValue value to be set
090     */
091
092    public void setOldValue(final Money oldValue);
093
094    /**
095     * factory method
096     * @return instance of StandalonePriceValueChangedMessage
097     */
098    public static StandalonePriceValueChangedMessage of() {
099        return new StandalonePriceValueChangedMessageImpl();
100    }
101
102    /**
103     * factory method to create a shallow copy StandalonePriceValueChangedMessage
104     * @param template instance to be copied
105     * @return copy instance
106     */
107    public static StandalonePriceValueChangedMessage of(final StandalonePriceValueChangedMessage template) {
108        StandalonePriceValueChangedMessageImpl instance = new StandalonePriceValueChangedMessageImpl();
109        instance.setId(template.getId());
110        instance.setVersion(template.getVersion());
111        instance.setCreatedAt(template.getCreatedAt());
112        instance.setLastModifiedAt(template.getLastModifiedAt());
113        instance.setLastModifiedBy(template.getLastModifiedBy());
114        instance.setCreatedBy(template.getCreatedBy());
115        instance.setSequenceNumber(template.getSequenceNumber());
116        instance.setResource(template.getResource());
117        instance.setResourceVersion(template.getResourceVersion());
118        instance.setResourceUserProvidedIdentifiers(template.getResourceUserProvidedIdentifiers());
119        instance.setValue(template.getValue());
120        instance.setStaged(template.getStaged());
121        instance.setOldValue(template.getOldValue());
122        return instance;
123    }
124
125    /**
126     * factory method to create a deep copy of StandalonePriceValueChangedMessage
127     * @param template instance to be copied
128     * @return copy instance
129     */
130    @Nullable
131    public static StandalonePriceValueChangedMessage deepCopy(
132            @Nullable final StandalonePriceValueChangedMessage template) {
133        if (template == null) {
134            return null;
135        }
136        StandalonePriceValueChangedMessageImpl instance = new StandalonePriceValueChangedMessageImpl();
137        instance.setId(template.getId());
138        instance.setVersion(template.getVersion());
139        instance.setCreatedAt(template.getCreatedAt());
140        instance.setLastModifiedAt(template.getLastModifiedAt());
141        instance.setLastModifiedBy(
142            com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy()));
143        instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy()));
144        instance.setSequenceNumber(template.getSequenceNumber());
145        instance.setResource(com.commercetools.api.models.common.Reference.deepCopy(template.getResource()));
146        instance.setResourceVersion(template.getResourceVersion());
147        instance.setResourceUserProvidedIdentifiers(com.commercetools.api.models.message.UserProvidedIdentifiers
148                .deepCopy(template.getResourceUserProvidedIdentifiers()));
149        instance.setValue(com.commercetools.api.models.common.Money.deepCopy(template.getValue()));
150        instance.setStaged(template.getStaged());
151        instance.setOldValue(com.commercetools.api.models.common.Money.deepCopy(template.getOldValue()));
152        return instance;
153    }
154
155    /**
156     * builder factory method for StandalonePriceValueChangedMessage
157     * @return builder
158     */
159    public static StandalonePriceValueChangedMessageBuilder builder() {
160        return StandalonePriceValueChangedMessageBuilder.of();
161    }
162
163    /**
164     * create builder for StandalonePriceValueChangedMessage instance
165     * @param template instance with prefilled values for the builder
166     * @return builder
167     */
168    public static StandalonePriceValueChangedMessageBuilder builder(final StandalonePriceValueChangedMessage template) {
169        return StandalonePriceValueChangedMessageBuilder.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 withStandalonePriceValueChangedMessage(Function<StandalonePriceValueChangedMessage, 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<StandalonePriceValueChangedMessage> typeReference() {
187        return new com.fasterxml.jackson.core.type.TypeReference<StandalonePriceValueChangedMessage>() {
188            @Override
189            public String toString() {
190                return "TypeReference<StandalonePriceValueChangedMessage>";
191            }
192        };
193    }
194}