001
002package com.commercetools.history.models.common;
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.fasterxml.jackson.annotation.*;
013import com.fasterxml.jackson.databind.annotation.*;
014
015import io.vrap.rmf.base.client.utils.Generated;
016
017/**
018 * LineItem
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     LineItem lineItem = LineItem.builder()
025 *             .addedAt("{addedAt}")
026 *             .custom(customBuilder -> customBuilder)
027 *             .id("{id}")
028 *             .name(nameBuilder -> nameBuilder)
029 *             .productId("{productId}")
030 *             .productSlug(productSlugBuilder -> productSlugBuilder)
031 *             .productType(productTypeBuilder -> productTypeBuilder)
032 *             .quantity(1)
033 *             .variant(variantBuilder -> variantBuilder)
034 *             .variantId(1)
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 = LineItemImpl.class)
041public interface LineItem {
042
043    /**
044     *
045     * @return addedAt
046     */
047    @NotNull
048    @JsonProperty("addedAt")
049    public String getAddedAt();
050
051    /**
052     *
053     * @return custom
054     */
055    @NotNull
056    @Valid
057    @JsonProperty("custom")
058    public CustomFields getCustom();
059
060    /**
061     *
062     * @return id
063     */
064    @NotNull
065    @JsonProperty("id")
066    public String getId();
067
068    /**
069     *
070     * @return name
071     */
072    @NotNull
073    @Valid
074    @JsonProperty("name")
075    public LocalizedString getName();
076
077    /**
078     *
079     * @return productId
080     */
081    @NotNull
082    @JsonProperty("productId")
083    public String getProductId();
084
085    /**
086     *
087     * @return productSlug
088     */
089    @NotNull
090    @Valid
091    @JsonProperty("productSlug")
092    public LocalizedString getProductSlug();
093
094    /**
095     *
096     * @return productType
097     */
098    @NotNull
099    @Valid
100    @JsonProperty("productType")
101    public Reference getProductType();
102
103    /**
104     *
105     * @return quantity
106     */
107    @NotNull
108    @JsonProperty("quantity")
109    public Integer getQuantity();
110
111    /**
112     *
113     * @return variant
114     */
115    @NotNull
116    @Valid
117    @JsonProperty("variant")
118    public Variant getVariant();
119
120    /**
121     *
122     * @return variantId
123     */
124    @NotNull
125    @JsonProperty("variantId")
126    public Integer getVariantId();
127
128    /**
129     * set addedAt
130     * @param addedAt value to be set
131     */
132
133    public void setAddedAt(final String addedAt);
134
135    /**
136     * set custom
137     * @param custom value to be set
138     */
139
140    public void setCustom(final CustomFields custom);
141
142    /**
143     * set id
144     * @param id value to be set
145     */
146
147    public void setId(final String id);
148
149    /**
150     * set name
151     * @param name value to be set
152     */
153
154    public void setName(final LocalizedString name);
155
156    /**
157     * set productId
158     * @param productId value to be set
159     */
160
161    public void setProductId(final String productId);
162
163    /**
164     * set productSlug
165     * @param productSlug value to be set
166     */
167
168    public void setProductSlug(final LocalizedString productSlug);
169
170    /**
171     * set productType
172     * @param productType value to be set
173     */
174
175    public void setProductType(final Reference productType);
176
177    /**
178     * set quantity
179     * @param quantity value to be set
180     */
181
182    public void setQuantity(final Integer quantity);
183
184    /**
185     * set variant
186     * @param variant value to be set
187     */
188
189    public void setVariant(final Variant variant);
190
191    /**
192     * set variantId
193     * @param variantId value to be set
194     */
195
196    public void setVariantId(final Integer variantId);
197
198    /**
199     * factory method
200     * @return instance of LineItem
201     */
202    public static LineItem of() {
203        return new LineItemImpl();
204    }
205
206    /**
207     * factory method to create a shallow copy LineItem
208     * @param template instance to be copied
209     * @return copy instance
210     */
211    public static LineItem of(final LineItem template) {
212        LineItemImpl instance = new LineItemImpl();
213        instance.setAddedAt(template.getAddedAt());
214        instance.setCustom(template.getCustom());
215        instance.setId(template.getId());
216        instance.setName(template.getName());
217        instance.setProductId(template.getProductId());
218        instance.setProductSlug(template.getProductSlug());
219        instance.setProductType(template.getProductType());
220        instance.setQuantity(template.getQuantity());
221        instance.setVariant(template.getVariant());
222        instance.setVariantId(template.getVariantId());
223        return instance;
224    }
225
226    /**
227     * factory method to create a deep copy of LineItem
228     * @param template instance to be copied
229     * @return copy instance
230     */
231    @Nullable
232    public static LineItem deepCopy(@Nullable final LineItem template) {
233        if (template == null) {
234            return null;
235        }
236        LineItemImpl instance = new LineItemImpl();
237        instance.setAddedAt(template.getAddedAt());
238        instance.setCustom(com.commercetools.history.models.common.CustomFields.deepCopy(template.getCustom()));
239        instance.setId(template.getId());
240        instance.setName(com.commercetools.history.models.common.LocalizedString.deepCopy(template.getName()));
241        instance.setProductId(template.getProductId());
242        instance.setProductSlug(
243            com.commercetools.history.models.common.LocalizedString.deepCopy(template.getProductSlug()));
244        instance.setProductType(com.commercetools.history.models.common.Reference.deepCopy(template.getProductType()));
245        instance.setQuantity(template.getQuantity());
246        instance.setVariant(com.commercetools.history.models.common.Variant.deepCopy(template.getVariant()));
247        instance.setVariantId(template.getVariantId());
248        return instance;
249    }
250
251    /**
252     * builder factory method for LineItem
253     * @return builder
254     */
255    public static LineItemBuilder builder() {
256        return LineItemBuilder.of();
257    }
258
259    /**
260     * create builder for LineItem instance
261     * @param template instance with prefilled values for the builder
262     * @return builder
263     */
264    public static LineItemBuilder builder(final LineItem template) {
265        return LineItemBuilder.of(template);
266    }
267
268    /**
269     * accessor map function
270     * @param <T> mapped type
271     * @param helper function to map the object
272     * @return mapped value
273     */
274    default <T> T withLineItem(Function<LineItem, T> helper) {
275        return helper.apply(this);
276    }
277
278    /**
279     * gives a TypeReference for usage with Jackson DataBind
280     * @return TypeReference
281     */
282    public static com.fasterxml.jackson.core.type.TypeReference<LineItem> typeReference() {
283        return new com.fasterxml.jackson.core.type.TypeReference<LineItem>() {
284            @Override
285            public String toString() {
286                return "TypeReference<LineItem>";
287            }
288        };
289    }
290}