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.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>Generated after a successful Set Rating 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 *     ReviewRatingSetMessage reviewRatingSetMessage = ReviewRatingSetMessage.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 *             .includedInStatistics(true)
034 *             .build()
035 * </code></pre>
036 * </div>
037 */
038@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
039@JsonDeserialize(as = ReviewRatingSetMessageImpl.class)
040public interface ReviewRatingSetMessage extends Message {
041
042    /**
043     * discriminator value for ReviewRatingSetMessage
044     */
045    String REVIEW_RATING_SET = "ReviewRatingSet";
046
047    /**
048     *  <p>The <code>rating</code> of the Review before the Set Rating update action.</p>
049     * @return oldRating
050     */
051
052    @JsonProperty("oldRating")
053    public Double getOldRating();
054
055    /**
056     *  <p>The <code>rating</code> of the Review after the Set Rating update action.</p>
057     * @return newRating
058     */
059
060    @JsonProperty("newRating")
061    public Double getNewRating();
062
063    /**
064     *  <p>Whether the Review was taken into account in the ratings statistics of the target.</p>
065     * @return includedInStatistics
066     */
067    @NotNull
068    @JsonProperty("includedInStatistics")
069    public Boolean getIncludedInStatistics();
070
071    /**
072     *  <p>Reference to the resource that the Review belongs to.</p>
073     * @return target
074     */
075    @Valid
076    @JsonProperty("target")
077    public Reference getTarget();
078
079    /**
080     *  <p>The <code>rating</code> of the Review before the Set Rating update action.</p>
081     * @param oldRating value to be set
082     */
083
084    public void setOldRating(final Double oldRating);
085
086    /**
087     *  <p>The <code>rating</code> of the Review after the Set Rating update action.</p>
088     * @param newRating value to be set
089     */
090
091    public void setNewRating(final Double newRating);
092
093    /**
094     *  <p>Whether the Review was taken into account in the ratings statistics of the target.</p>
095     * @param includedInStatistics value to be set
096     */
097
098    public void setIncludedInStatistics(final Boolean includedInStatistics);
099
100    /**
101     *  <p>Reference to the resource that the Review belongs to.</p>
102     * @param target value to be set
103     */
104
105    public void setTarget(final Reference target);
106
107    /**
108     * factory method
109     * @return instance of ReviewRatingSetMessage
110     */
111    public static ReviewRatingSetMessage of() {
112        return new ReviewRatingSetMessageImpl();
113    }
114
115    /**
116     * factory method to create a shallow copy ReviewRatingSetMessage
117     * @param template instance to be copied
118     * @return copy instance
119     */
120    public static ReviewRatingSetMessage of(final ReviewRatingSetMessage template) {
121        ReviewRatingSetMessageImpl instance = new ReviewRatingSetMessageImpl();
122        instance.setId(template.getId());
123        instance.setVersion(template.getVersion());
124        instance.setCreatedAt(template.getCreatedAt());
125        instance.setLastModifiedAt(template.getLastModifiedAt());
126        instance.setLastModifiedBy(template.getLastModifiedBy());
127        instance.setCreatedBy(template.getCreatedBy());
128        instance.setSequenceNumber(template.getSequenceNumber());
129        instance.setResource(template.getResource());
130        instance.setResourceVersion(template.getResourceVersion());
131        instance.setResourceUserProvidedIdentifiers(template.getResourceUserProvidedIdentifiers());
132        instance.setOldRating(template.getOldRating());
133        instance.setNewRating(template.getNewRating());
134        instance.setIncludedInStatistics(template.getIncludedInStatistics());
135        instance.setTarget(template.getTarget());
136        return instance;
137    }
138
139    /**
140     * factory method to create a deep copy of ReviewRatingSetMessage
141     * @param template instance to be copied
142     * @return copy instance
143     */
144    @Nullable
145    public static ReviewRatingSetMessage deepCopy(@Nullable final ReviewRatingSetMessage template) {
146        if (template == null) {
147            return null;
148        }
149        ReviewRatingSetMessageImpl instance = new ReviewRatingSetMessageImpl();
150        instance.setId(template.getId());
151        instance.setVersion(template.getVersion());
152        instance.setCreatedAt(template.getCreatedAt());
153        instance.setLastModifiedAt(template.getLastModifiedAt());
154        instance.setLastModifiedBy(
155            com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy()));
156        instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy()));
157        instance.setSequenceNumber(template.getSequenceNumber());
158        instance.setResource(com.commercetools.api.models.common.Reference.deepCopy(template.getResource()));
159        instance.setResourceVersion(template.getResourceVersion());
160        instance.setResourceUserProvidedIdentifiers(com.commercetools.api.models.message.UserProvidedIdentifiers
161                .deepCopy(template.getResourceUserProvidedIdentifiers()));
162        instance.setOldRating(template.getOldRating());
163        instance.setNewRating(template.getNewRating());
164        instance.setIncludedInStatistics(template.getIncludedInStatistics());
165        instance.setTarget(com.commercetools.api.models.common.Reference.deepCopy(template.getTarget()));
166        return instance;
167    }
168
169    /**
170     * builder factory method for ReviewRatingSetMessage
171     * @return builder
172     */
173    public static ReviewRatingSetMessageBuilder builder() {
174        return ReviewRatingSetMessageBuilder.of();
175    }
176
177    /**
178     * create builder for ReviewRatingSetMessage instance
179     * @param template instance with prefilled values for the builder
180     * @return builder
181     */
182    public static ReviewRatingSetMessageBuilder builder(final ReviewRatingSetMessage template) {
183        return ReviewRatingSetMessageBuilder.of(template);
184    }
185
186    /**
187     * accessor map function
188     * @param <T> mapped type
189     * @param helper function to map the object
190     * @return mapped value
191     */
192    default <T> T withReviewRatingSetMessage(Function<ReviewRatingSetMessage, T> helper) {
193        return helper.apply(this);
194    }
195
196    /**
197     * gives a TypeReference for usage with Jackson DataBind
198     * @return TypeReference
199     */
200    public static com.fasterxml.jackson.core.type.TypeReference<ReviewRatingSetMessage> typeReference() {
201        return new com.fasterxml.jackson.core.type.TypeReference<ReviewRatingSetMessage>() {
202            @Override
203            public String toString() {
204                return "TypeReference<ReviewRatingSetMessage>";
205            }
206        };
207    }
208}