001
002package com.commercetools.history.models.common;
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.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 * ReturnInfo
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     ReturnInfo returnInfo = ReturnInfo.builder()
026 *             .plusItems(itemsBuilder -> itemsBuilder)
027 *             .returnTrackingId("{returnTrackingId}")
028 *             .returnDate("{returnDate}")
029 *             .build()
030 * </code></pre>
031 * </div>
032 */
033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
034@JsonDeserialize(as = ReturnInfoImpl.class)
035public interface ReturnInfo {
036
037    /**
038     *
039     * @return items
040     */
041    @NotNull
042    @Valid
043    @JsonProperty("items")
044    public List<ReturnItem> getItems();
045
046    /**
047     *  <p>Identifies, which return tracking ID is connected to this particular return.</p>
048     * @return returnTrackingId
049     */
050    @NotNull
051    @JsonProperty("returnTrackingId")
052    public String getReturnTrackingId();
053
054    /**
055     *
056     * @return returnDate
057     */
058    @NotNull
059    @JsonProperty("returnDate")
060    public String getReturnDate();
061
062    /**
063     * set items
064     * @param items values to be set
065     */
066
067    @JsonIgnore
068    public void setItems(final ReturnItem... items);
069
070    /**
071     * set items
072     * @param items values to be set
073     */
074
075    public void setItems(final List<ReturnItem> items);
076
077    /**
078     *  <p>Identifies, which return tracking ID is connected to this particular return.</p>
079     * @param returnTrackingId value to be set
080     */
081
082    public void setReturnTrackingId(final String returnTrackingId);
083
084    /**
085     * set returnDate
086     * @param returnDate value to be set
087     */
088
089    public void setReturnDate(final String returnDate);
090
091    /**
092     * factory method
093     * @return instance of ReturnInfo
094     */
095    public static ReturnInfo of() {
096        return new ReturnInfoImpl();
097    }
098
099    /**
100     * factory method to create a shallow copy ReturnInfo
101     * @param template instance to be copied
102     * @return copy instance
103     */
104    public static ReturnInfo of(final ReturnInfo template) {
105        ReturnInfoImpl instance = new ReturnInfoImpl();
106        instance.setItems(template.getItems());
107        instance.setReturnTrackingId(template.getReturnTrackingId());
108        instance.setReturnDate(template.getReturnDate());
109        return instance;
110    }
111
112    /**
113     * factory method to create a deep copy of ReturnInfo
114     * @param template instance to be copied
115     * @return copy instance
116     */
117    @Nullable
118    public static ReturnInfo deepCopy(@Nullable final ReturnInfo template) {
119        if (template == null) {
120            return null;
121        }
122        ReturnInfoImpl instance = new ReturnInfoImpl();
123        instance.setItems(Optional.ofNullable(template.getItems())
124                .map(t -> t.stream()
125                        .map(com.commercetools.history.models.common.ReturnItem::deepCopy)
126                        .collect(Collectors.toList()))
127                .orElse(null));
128        instance.setReturnTrackingId(template.getReturnTrackingId());
129        instance.setReturnDate(template.getReturnDate());
130        return instance;
131    }
132
133    /**
134     * builder factory method for ReturnInfo
135     * @return builder
136     */
137    public static ReturnInfoBuilder builder() {
138        return ReturnInfoBuilder.of();
139    }
140
141    /**
142     * create builder for ReturnInfo instance
143     * @param template instance with prefilled values for the builder
144     * @return builder
145     */
146    public static ReturnInfoBuilder builder(final ReturnInfo template) {
147        return ReturnInfoBuilder.of(template);
148    }
149
150    /**
151     * accessor map function
152     * @param <T> mapped type
153     * @param helper function to map the object
154     * @return mapped value
155     */
156    default <T> T withReturnInfo(Function<ReturnInfo, T> helper) {
157        return helper.apply(this);
158    }
159
160    /**
161     * gives a TypeReference for usage with Jackson DataBind
162     * @return TypeReference
163     */
164    public static com.fasterxml.jackson.core.type.TypeReference<ReturnInfo> typeReference() {
165        return new com.fasterxml.jackson.core.type.TypeReference<ReturnInfo>() {
166            @Override
167            public String toString() {
168                return "TypeReference<ReturnInfo>";
169            }
170        };
171    }
172}