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 * CustomLineItem
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     CustomLineItem customLineItem = CustomLineItem.builder()
025 *             .id("{id}")
026 *             .name(nameBuilder -> nameBuilder)
027 *             .money(moneyBuilder -> moneyBuilder)
028 *             .taxedPrice(taxedPriceBuilder -> taxedPriceBuilder)
029 *             .totalPrice(totalPriceBuilder -> totalPriceBuilder)
030 *             .slug("{slug}")
031 *             .quantity(1)
032 *             .build()
033 * </code></pre>
034 * </div>
035 */
036@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
037@JsonDeserialize(as = CustomLineItemImpl.class)
038public interface CustomLineItem {
039
040    /**
041     *  <p>The unique ID of this CustomLineItem.</p>
042     * @return id
043     */
044    @NotNull
045    @JsonProperty("id")
046    public String getId();
047
048    /**
049     *
050     * @return name
051     */
052    @NotNull
053    @Valid
054    @JsonProperty("name")
055    public LocalizedString getName();
056
057    /**
058     *
059     * @return money
060     */
061    @NotNull
062    @Valid
063    @JsonProperty("money")
064    public Money getMoney();
065
066    /**
067     *
068     * @return taxedPrice
069     */
070    @NotNull
071    @Valid
072    @JsonProperty("taxedPrice")
073    public TaxedItemPrice getTaxedPrice();
074
075    /**
076     *
077     * @return totalPrice
078     */
079    @NotNull
080    @Valid
081    @JsonProperty("totalPrice")
082    public Money getTotalPrice();
083
084    /**
085     *  <p>A unique String in the cart to identify this CustomLineItem.</p>
086     * @return slug
087     */
088    @NotNull
089    @JsonProperty("slug")
090    public String getSlug();
091
092    /**
093     *  <p>The amount of a CustomLineItem in the cart. Must be a positive integer.</p>
094     * @return quantity
095     */
096    @NotNull
097    @JsonProperty("quantity")
098    public Integer getQuantity();
099
100    /**
101     *  <p>The unique ID of this CustomLineItem.</p>
102     * @param id value to be set
103     */
104
105    public void setId(final String id);
106
107    /**
108     * set name
109     * @param name value to be set
110     */
111
112    public void setName(final LocalizedString name);
113
114    /**
115     * set money
116     * @param money value to be set
117     */
118
119    public void setMoney(final Money money);
120
121    /**
122     * set taxedPrice
123     * @param taxedPrice value to be set
124     */
125
126    public void setTaxedPrice(final TaxedItemPrice taxedPrice);
127
128    /**
129     * set totalPrice
130     * @param totalPrice value to be set
131     */
132
133    public void setTotalPrice(final Money totalPrice);
134
135    /**
136     *  <p>A unique String in the cart to identify this CustomLineItem.</p>
137     * @param slug value to be set
138     */
139
140    public void setSlug(final String slug);
141
142    /**
143     *  <p>The amount of a CustomLineItem in the cart. Must be a positive integer.</p>
144     * @param quantity value to be set
145     */
146
147    public void setQuantity(final Integer quantity);
148
149    /**
150     * factory method
151     * @return instance of CustomLineItem
152     */
153    public static CustomLineItem of() {
154        return new CustomLineItemImpl();
155    }
156
157    /**
158     * factory method to create a shallow copy CustomLineItem
159     * @param template instance to be copied
160     * @return copy instance
161     */
162    public static CustomLineItem of(final CustomLineItem template) {
163        CustomLineItemImpl instance = new CustomLineItemImpl();
164        instance.setId(template.getId());
165        instance.setName(template.getName());
166        instance.setMoney(template.getMoney());
167        instance.setTaxedPrice(template.getTaxedPrice());
168        instance.setTotalPrice(template.getTotalPrice());
169        instance.setSlug(template.getSlug());
170        instance.setQuantity(template.getQuantity());
171        return instance;
172    }
173
174    /**
175     * factory method to create a deep copy of CustomLineItem
176     * @param template instance to be copied
177     * @return copy instance
178     */
179    @Nullable
180    public static CustomLineItem deepCopy(@Nullable final CustomLineItem template) {
181        if (template == null) {
182            return null;
183        }
184        CustomLineItemImpl instance = new CustomLineItemImpl();
185        instance.setId(template.getId());
186        instance.setName(com.commercetools.history.models.common.LocalizedString.deepCopy(template.getName()));
187        instance.setMoney(com.commercetools.history.models.common.Money.deepCopy(template.getMoney()));
188        instance.setTaxedPrice(
189            com.commercetools.history.models.common.TaxedItemPrice.deepCopy(template.getTaxedPrice()));
190        instance.setTotalPrice(com.commercetools.history.models.common.Money.deepCopy(template.getTotalPrice()));
191        instance.setSlug(template.getSlug());
192        instance.setQuantity(template.getQuantity());
193        return instance;
194    }
195
196    /**
197     * builder factory method for CustomLineItem
198     * @return builder
199     */
200    public static CustomLineItemBuilder builder() {
201        return CustomLineItemBuilder.of();
202    }
203
204    /**
205     * create builder for CustomLineItem instance
206     * @param template instance with prefilled values for the builder
207     * @return builder
208     */
209    public static CustomLineItemBuilder builder(final CustomLineItem template) {
210        return CustomLineItemBuilder.of(template);
211    }
212
213    /**
214     * accessor map function
215     * @param <T> mapped type
216     * @param helper function to map the object
217     * @return mapped value
218     */
219    default <T> T withCustomLineItem(Function<CustomLineItem, T> helper) {
220        return helper.apply(this);
221    }
222
223    /**
224     * gives a TypeReference for usage with Jackson DataBind
225     * @return TypeReference
226     */
227    public static com.fasterxml.jackson.core.type.TypeReference<CustomLineItem> typeReference() {
228        return new com.fasterxml.jackson.core.type.TypeReference<CustomLineItem>() {
229            @Override
230            public String toString() {
231                return "TypeReference<CustomLineItem>";
232            }
233        };
234    }
235}