001
002package com.commercetools.api.models.review;
003
004import java.time.*;
005import java.time.ZonedDateTime;
006import java.util.*;
007import java.util.function.Function;
008
009import javax.annotation.Nullable;
010import javax.validation.Valid;
011import javax.validation.constraints.NotNull;
012
013import com.commercetools.api.models.common.BaseResource;
014import com.commercetools.api.models.common.CreatedBy;
015import com.commercetools.api.models.common.LastModifiedBy;
016import com.commercetools.api.models.common.Reference;
017import com.commercetools.api.models.customer.CustomerReference;
018import com.commercetools.api.models.state.StateReference;
019import com.commercetools.api.models.type.CustomFields;
020import com.fasterxml.jackson.annotation.*;
021import com.fasterxml.jackson.databind.annotation.*;
022
023import io.vrap.rmf.base.client.utils.Generated;
024
025/**
026 * Review
027 *
028 * <hr>
029 * Example to create an instance using the builder pattern
030 * <div class=code-example>
031 * <pre><code class='java'>
032 *     Review review = Review.builder()
033 *             .id("{id}")
034 *             .version(0.3)
035 *             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
036 *             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
037 *             .includedInStatistics(true)
038 *             .build()
039 * </code></pre>
040 * </div>
041 */
042@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
043@JsonDeserialize(as = ReviewImpl.class)
044public interface Review extends BaseResource, ReviewMixin, com.commercetools.api.models.DomainResource<Review>,
045        com.commercetools.api.models.Referencable<Review>, com.commercetools.api.models.ResourceIdentifiable<Review>,
046        com.commercetools.api.models.Customizable<Review>, com.commercetools.api.models.WithKey {
047
048    /**
049     *  <p>Unique identifier of the Review.</p>
050     * @return id
051     */
052    @NotNull
053    @JsonProperty("id")
054    public String getId();
055
056    /**
057     *  <p>Current version of the Review.</p>
058     * @return version
059     */
060    @NotNull
061    @JsonProperty("version")
062    public Long getVersion();
063
064    /**
065     *  <p>Date and time (UTC) the Review was initially created.</p>
066     * @return createdAt
067     */
068    @NotNull
069    @JsonProperty("createdAt")
070    public ZonedDateTime getCreatedAt();
071
072    /**
073     *  <p>Date and time (UTC) the Review was last updated.</p>
074     * @return lastModifiedAt
075     */
076    @NotNull
077    @JsonProperty("lastModifiedAt")
078    public ZonedDateTime getLastModifiedAt();
079
080    /**
081     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
082     * @return lastModifiedBy
083     */
084    @Valid
085    @JsonProperty("lastModifiedBy")
086    public LastModifiedBy getLastModifiedBy();
087
088    /**
089     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
090     * @return createdBy
091     */
092    @Valid
093    @JsonProperty("createdBy")
094    public CreatedBy getCreatedBy();
095
096    /**
097     *  <p>User-defined unique identifier of the Review.</p>
098     * @return key
099     */
100
101    @JsonProperty("key")
102    public String getKey();
103
104    /**
105     *  <p>Must be unique among Reviews. For example, if this value is set to Customer <code>id</code>&nbsp;+ Product <code>id</code>, only one Review per Customer and per Product is allowed.</p>
106     * @return uniquenessValue
107     */
108
109    @JsonProperty("uniquenessValue")
110    public String getUniquenessValue();
111
112    /**
113     *  <p>Language in which the content of the Review is written.</p>
114     * @return locale
115     */
116
117    @JsonProperty("locale")
118    public String getLocale();
119
120    /**
121     *  <p>Name of the author.</p>
122     * @return authorName
123     */
124
125    @JsonProperty("authorName")
126    public String getAuthorName();
127
128    /**
129     *  <p>Title of the Review.</p>
130     * @return title
131     */
132
133    @JsonProperty("title")
134    public String getTitle();
135
136    /**
137     *  <p>Content of the Review.</p>
138     * @return text
139     */
140
141    @JsonProperty("text")
142    public String getText();
143
144    /**
145     *  <p>A Reference represents a loose reference to another resource in the same Project identified by its <code>id</code>. The <code>typeId</code> indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like ChannelReference. A referenced resource can be embedded through Reference Expansion. The expanded reference is the value of an additional <code>obj</code> field then.</p>
146     * @return target
147     */
148    @Valid
149    @JsonProperty("target")
150    public Reference getTarget();
151
152    /**
153     *  <p>Indicates if this Review is taken into account in the ratings statistics of the target. A Review is per default used in the statistics, unless the Review is in a state that does not have the role <code>ReviewIncludedInStatistics</code>. If the role of a State is modified after the calculation of this field, the calculation is not updated.</p>
154     * @return includedInStatistics
155     */
156    @NotNull
157    @JsonProperty("includedInStatistics")
158    public Boolean getIncludedInStatistics();
159
160    /**
161     *  <p>Rating of the Product or Channel.</p>
162     * @return rating
163     */
164
165    @JsonProperty("rating")
166    public Integer getRating();
167
168    /**
169     *  <p>State of the Review. Used for approval processes, see Review approval process for details.</p>
170     * @return state
171     */
172    @Valid
173    @JsonProperty("state")
174    public StateReference getState();
175
176    /**
177     *  <p>Customer who created the Review.</p>
178     * @return customer
179     */
180    @Valid
181    @JsonProperty("customer")
182    public CustomerReference getCustomer();
183
184    /**
185     *  <p>Custom Fields of the Review.</p>
186     * @return custom
187     */
188    @Valid
189    @JsonProperty("custom")
190    public CustomFields getCustom();
191
192    /**
193     *  <p>Unique identifier of the Review.</p>
194     * @param id value to be set
195     */
196
197    public void setId(final String id);
198
199    /**
200     *  <p>Current version of the Review.</p>
201     * @param version value to be set
202     */
203
204    public void setVersion(final Long version);
205
206    /**
207     *  <p>Date and time (UTC) the Review was initially created.</p>
208     * @param createdAt value to be set
209     */
210
211    public void setCreatedAt(final ZonedDateTime createdAt);
212
213    /**
214     *  <p>Date and time (UTC) the Review was last updated.</p>
215     * @param lastModifiedAt value to be set
216     */
217
218    public void setLastModifiedAt(final ZonedDateTime lastModifiedAt);
219
220    /**
221     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
222     * @param lastModifiedBy value to be set
223     */
224
225    public void setLastModifiedBy(final LastModifiedBy lastModifiedBy);
226
227    /**
228     *  <p>Present on resources created after 1 February 2019 except for events not tracked.</p>
229     * @param createdBy value to be set
230     */
231
232    public void setCreatedBy(final CreatedBy createdBy);
233
234    /**
235     *  <p>User-defined unique identifier of the Review.</p>
236     * @param key value to be set
237     */
238
239    public void setKey(final String key);
240
241    /**
242     *  <p>Must be unique among Reviews. For example, if this value is set to Customer <code>id</code>&nbsp;+ Product <code>id</code>, only one Review per Customer and per Product is allowed.</p>
243     * @param uniquenessValue value to be set
244     */
245
246    public void setUniquenessValue(final String uniquenessValue);
247
248    /**
249     *  <p>Language in which the content of the Review is written.</p>
250     * @param locale value to be set
251     */
252
253    public void setLocale(final String locale);
254
255    /**
256     *  <p>Name of the author.</p>
257     * @param authorName value to be set
258     */
259
260    public void setAuthorName(final String authorName);
261
262    /**
263     *  <p>Title of the Review.</p>
264     * @param title value to be set
265     */
266
267    public void setTitle(final String title);
268
269    /**
270     *  <p>Content of the Review.</p>
271     * @param text value to be set
272     */
273
274    public void setText(final String text);
275
276    /**
277     *  <p>A Reference represents a loose reference to another resource in the same Project identified by its <code>id</code>. The <code>typeId</code> indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like ChannelReference. A referenced resource can be embedded through Reference Expansion. The expanded reference is the value of an additional <code>obj</code> field then.</p>
278     * @param target value to be set
279     */
280
281    public void setTarget(final Reference target);
282
283    /**
284     *  <p>Indicates if this Review is taken into account in the ratings statistics of the target. A Review is per default used in the statistics, unless the Review is in a state that does not have the role <code>ReviewIncludedInStatistics</code>. If the role of a State is modified after the calculation of this field, the calculation is not updated.</p>
285     * @param includedInStatistics value to be set
286     */
287
288    public void setIncludedInStatistics(final Boolean includedInStatistics);
289
290    /**
291     *  <p>Rating of the Product or Channel.</p>
292     * @param rating value to be set
293     */
294
295    public void setRating(final Integer rating);
296
297    /**
298     *  <p>State of the Review. Used for approval processes, see Review approval process for details.</p>
299     * @param state value to be set
300     */
301
302    public void setState(final StateReference state);
303
304    /**
305     *  <p>Customer who created the Review.</p>
306     * @param customer value to be set
307     */
308
309    public void setCustomer(final CustomerReference customer);
310
311    /**
312     *  <p>Custom Fields of the Review.</p>
313     * @param custom value to be set
314     */
315
316    public void setCustom(final CustomFields custom);
317
318    /**
319     * factory method
320     * @return instance of Review
321     */
322    public static Review of() {
323        return new ReviewImpl();
324    }
325
326    /**
327     * factory method to create a shallow copy Review
328     * @param template instance to be copied
329     * @return copy instance
330     */
331    public static Review of(final Review template) {
332        ReviewImpl instance = new ReviewImpl();
333        instance.setId(template.getId());
334        instance.setVersion(template.getVersion());
335        instance.setCreatedAt(template.getCreatedAt());
336        instance.setLastModifiedAt(template.getLastModifiedAt());
337        instance.setLastModifiedBy(template.getLastModifiedBy());
338        instance.setCreatedBy(template.getCreatedBy());
339        instance.setKey(template.getKey());
340        instance.setUniquenessValue(template.getUniquenessValue());
341        instance.setLocale(template.getLocale());
342        instance.setAuthorName(template.getAuthorName());
343        instance.setTitle(template.getTitle());
344        instance.setText(template.getText());
345        instance.setTarget(template.getTarget());
346        instance.setIncludedInStatistics(template.getIncludedInStatistics());
347        instance.setRating(template.getRating());
348        instance.setState(template.getState());
349        instance.setCustomer(template.getCustomer());
350        instance.setCustom(template.getCustom());
351        return instance;
352    }
353
354    /**
355     * factory method to create a deep copy of Review
356     * @param template instance to be copied
357     * @return copy instance
358     */
359    @Nullable
360    public static Review deepCopy(@Nullable final Review template) {
361        if (template == null) {
362            return null;
363        }
364        ReviewImpl instance = new ReviewImpl();
365        instance.setId(template.getId());
366        instance.setVersion(template.getVersion());
367        instance.setCreatedAt(template.getCreatedAt());
368        instance.setLastModifiedAt(template.getLastModifiedAt());
369        instance.setLastModifiedBy(
370            com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy()));
371        instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy()));
372        instance.setKey(template.getKey());
373        instance.setUniquenessValue(template.getUniquenessValue());
374        instance.setLocale(template.getLocale());
375        instance.setAuthorName(template.getAuthorName());
376        instance.setTitle(template.getTitle());
377        instance.setText(template.getText());
378        instance.setTarget(com.commercetools.api.models.common.Reference.deepCopy(template.getTarget()));
379        instance.setIncludedInStatistics(template.getIncludedInStatistics());
380        instance.setRating(template.getRating());
381        instance.setState(com.commercetools.api.models.state.StateReference.deepCopy(template.getState()));
382        instance.setCustomer(com.commercetools.api.models.customer.CustomerReference.deepCopy(template.getCustomer()));
383        instance.setCustom(com.commercetools.api.models.type.CustomFields.deepCopy(template.getCustom()));
384        return instance;
385    }
386
387    /**
388     * builder factory method for Review
389     * @return builder
390     */
391    public static ReviewBuilder builder() {
392        return ReviewBuilder.of();
393    }
394
395    /**
396     * create builder for Review instance
397     * @param template instance with prefilled values for the builder
398     * @return builder
399     */
400    public static ReviewBuilder builder(final Review template) {
401        return ReviewBuilder.of(template);
402    }
403
404    /**
405     * accessor map function
406     * @param <T> mapped type
407     * @param helper function to map the object
408     * @return mapped value
409     */
410    default <T> T withReview(Function<Review, T> helper) {
411        return helper.apply(this);
412    }
413
414    public static com.commercetools.api.models.common.ReferenceTypeId referenceTypeId() {
415        return com.commercetools.api.models.common.ReferenceTypeId.REVIEW;
416    }
417
418    @Deprecated
419    @JsonIgnore
420    public default void setTarget(final Object target) {
421        setTarget((Reference) target);
422    };
423
424    /**
425     * gives a TypeReference for usage with Jackson DataBind
426     * @return TypeReference
427     */
428    public static com.fasterxml.jackson.core.type.TypeReference<Review> typeReference() {
429        return new com.fasterxml.jackson.core.type.TypeReference<Review>() {
430            @Override
431            public String toString() {
432                return "TypeReference<Review>";
433            }
434        };
435    }
436}