001
002package com.commercetools.api.models.order;
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.commercetools.api.models.cart.InventoryMode;
014import com.commercetools.api.models.cart.ItemShippingDetailsDraft;
015import com.commercetools.api.models.channel.ChannelResourceIdentifier;
016import com.commercetools.api.models.common.LocalizedString;
017import com.commercetools.api.models.common.PriceDraft;
018import com.commercetools.api.models.tax_category.TaxRate;
019import com.commercetools.api.models.type.CustomFieldsDraft;
020import com.fasterxml.jackson.annotation.*;
021import com.fasterxml.jackson.databind.annotation.*;
022
023import io.vrap.rmf.base.client.utils.Generated;
024
025/**
026 * LineItemImportDraft
027 *
028 * <hr>
029 * Example to create an instance using the builder pattern
030 * <div class=code-example>
031 * <pre><code class='java'>
032 *     LineItemImportDraft lineItemImportDraft = LineItemImportDraft.builder()
033 *             .name(nameBuilder -> nameBuilder)
034 *             .variant(variantBuilder -> variantBuilder)
035 *             .price(priceBuilder -> priceBuilder)
036 *             .quantity(0.3)
037 *             .build()
038 * </code></pre>
039 * </div>
040 */
041@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
042@JsonDeserialize(as = LineItemImportDraftImpl.class)
043public interface LineItemImportDraft extends com.commercetools.api.models.CustomizableDraft<LineItemImportDraft>,
044        io.vrap.rmf.base.client.Draft<LineItemImportDraft> {
045
046    /**
047     *  <p>ID of the existing product. You also need to specify the ID of the variant if this property is set or alternatively you can just specify SKU of the product variant.</p>
048     * @return productId
049     */
050
051    @JsonProperty("productId")
052    public String getProductId();
053
054    /**
055     *  <p>The product name.</p>
056     * @return name
057     */
058    @NotNull
059    @Valid
060    @JsonProperty("name")
061    public LocalizedString getName();
062
063    /**
064     *
065     * @return variant
066     */
067    @NotNull
068    @Valid
069    @JsonProperty("variant")
070    public ProductVariantImportDraft getVariant();
071
072    /**
073     *
074     * @return price
075     */
076    @NotNull
077    @Valid
078    @JsonProperty("price")
079    public PriceDraft getPrice();
080
081    /**
082     *
083     * @return quantity
084     */
085    @NotNull
086    @JsonProperty("quantity")
087    public Long getQuantity();
088
089    /**
090     *
091     * @return state
092     */
093    @Valid
094    @JsonProperty("state")
095    public List<ItemState> getState();
096
097    /**
098     *  <p>Connection to a particular supplier. By providing supply channel information, you can uniquely identify inventory entries that should be reserved. The provided channel should have the InventorySupply role.</p>
099     * @return supplyChannel
100     */
101    @Valid
102    @JsonProperty("supplyChannel")
103    public ChannelResourceIdentifier getSupplyChannel();
104
105    /**
106     *  <p>The channel is used to select a ProductPrice. The provided channel should have the ProductDistribution role.</p>
107     * @return distributionChannel
108     */
109    @Valid
110    @JsonProperty("distributionChannel")
111    public ChannelResourceIdentifier getDistributionChannel();
112
113    /**
114     *
115     * @return taxRate
116     */
117    @Valid
118    @JsonProperty("taxRate")
119    public TaxRate getTaxRate();
120
121    /**
122     *  <p>The custom fields.</p>
123     * @return custom
124     */
125    @Valid
126    @JsonProperty("custom")
127    public CustomFieldsDraft getCustom();
128
129    /**
130     *  <p>Inventory mode specific to the line item only, valid for the entire <code>quantity</code> of the line item. Set only if inventory mode should be different from the <code>inventoryMode</code> specified on the OrderImportDraft.</p>
131     * @return inventoryMode
132     */
133
134    @JsonProperty("inventoryMode")
135    public InventoryMode getInventoryMode();
136
137    /**
138     *
139     * @return shippingDetails
140     */
141    @Valid
142    @JsonProperty("shippingDetails")
143    public ItemShippingDetailsDraft getShippingDetails();
144
145    /**
146     *  <p>ID of the existing product. You also need to specify the ID of the variant if this property is set or alternatively you can just specify SKU of the product variant.</p>
147     * @param productId value to be set
148     */
149
150    public void setProductId(final String productId);
151
152    /**
153     *  <p>The product name.</p>
154     * @param name value to be set
155     */
156
157    public void setName(final LocalizedString name);
158
159    /**
160     * set variant
161     * @param variant value to be set
162     */
163
164    public void setVariant(final ProductVariantImportDraft variant);
165
166    /**
167     * set price
168     * @param price value to be set
169     */
170
171    public void setPrice(final PriceDraft price);
172
173    /**
174     * set quantity
175     * @param quantity value to be set
176     */
177
178    public void setQuantity(final Long quantity);
179
180    /**
181     * set state
182     * @param state values to be set
183     */
184
185    @JsonIgnore
186    public void setState(final ItemState... state);
187
188    /**
189     * set state
190     * @param state values to be set
191     */
192
193    public void setState(final List<ItemState> state);
194
195    /**
196     *  <p>Connection to a particular supplier. By providing supply channel information, you can uniquely identify inventory entries that should be reserved. The provided channel should have the InventorySupply role.</p>
197     * @param supplyChannel value to be set
198     */
199
200    public void setSupplyChannel(final ChannelResourceIdentifier supplyChannel);
201
202    /**
203     *  <p>The channel is used to select a ProductPrice. The provided channel should have the ProductDistribution role.</p>
204     * @param distributionChannel value to be set
205     */
206
207    public void setDistributionChannel(final ChannelResourceIdentifier distributionChannel);
208
209    /**
210     * set taxRate
211     * @param taxRate value to be set
212     */
213
214    public void setTaxRate(final TaxRate taxRate);
215
216    /**
217     *  <p>The custom fields.</p>
218     * @param custom value to be set
219     */
220
221    public void setCustom(final CustomFieldsDraft custom);
222
223    /**
224     *  <p>Inventory mode specific to the line item only, valid for the entire <code>quantity</code> of the line item. Set only if inventory mode should be different from the <code>inventoryMode</code> specified on the OrderImportDraft.</p>
225     * @param inventoryMode value to be set
226     */
227
228    public void setInventoryMode(final InventoryMode inventoryMode);
229
230    /**
231     * set shippingDetails
232     * @param shippingDetails value to be set
233     */
234
235    public void setShippingDetails(final ItemShippingDetailsDraft shippingDetails);
236
237    /**
238     * factory method
239     * @return instance of LineItemImportDraft
240     */
241    public static LineItemImportDraft of() {
242        return new LineItemImportDraftImpl();
243    }
244
245    /**
246     * factory method to create a shallow copy LineItemImportDraft
247     * @param template instance to be copied
248     * @return copy instance
249     */
250    public static LineItemImportDraft of(final LineItemImportDraft template) {
251        LineItemImportDraftImpl instance = new LineItemImportDraftImpl();
252        instance.setProductId(template.getProductId());
253        instance.setName(template.getName());
254        instance.setVariant(template.getVariant());
255        instance.setPrice(template.getPrice());
256        instance.setQuantity(template.getQuantity());
257        instance.setState(template.getState());
258        instance.setSupplyChannel(template.getSupplyChannel());
259        instance.setDistributionChannel(template.getDistributionChannel());
260        instance.setTaxRate(template.getTaxRate());
261        instance.setCustom(template.getCustom());
262        instance.setInventoryMode(template.getInventoryMode());
263        instance.setShippingDetails(template.getShippingDetails());
264        return instance;
265    }
266
267    /**
268     * factory method to create a deep copy of LineItemImportDraft
269     * @param template instance to be copied
270     * @return copy instance
271     */
272    @Nullable
273    public static LineItemImportDraft deepCopy(@Nullable final LineItemImportDraft template) {
274        if (template == null) {
275            return null;
276        }
277        LineItemImportDraftImpl instance = new LineItemImportDraftImpl();
278        instance.setProductId(template.getProductId());
279        instance.setName(com.commercetools.api.models.common.LocalizedString.deepCopy(template.getName()));
280        instance.setVariant(
281            com.commercetools.api.models.order.ProductVariantImportDraft.deepCopy(template.getVariant()));
282        instance.setPrice(com.commercetools.api.models.common.PriceDraft.deepCopy(template.getPrice()));
283        instance.setQuantity(template.getQuantity());
284        instance.setState(Optional.ofNullable(template.getState())
285                .map(t -> t.stream()
286                        .map(com.commercetools.api.models.order.ItemState::deepCopy)
287                        .collect(Collectors.toList()))
288                .orElse(null));
289        instance.setSupplyChannel(
290            com.commercetools.api.models.channel.ChannelResourceIdentifier.deepCopy(template.getSupplyChannel()));
291        instance.setDistributionChannel(
292            com.commercetools.api.models.channel.ChannelResourceIdentifier.deepCopy(template.getDistributionChannel()));
293        instance.setTaxRate(com.commercetools.api.models.tax_category.TaxRate.deepCopy(template.getTaxRate()));
294        instance.setCustom(com.commercetools.api.models.type.CustomFieldsDraft.deepCopy(template.getCustom()));
295        instance.setInventoryMode(template.getInventoryMode());
296        instance.setShippingDetails(
297            com.commercetools.api.models.cart.ItemShippingDetailsDraft.deepCopy(template.getShippingDetails()));
298        return instance;
299    }
300
301    /**
302     * builder factory method for LineItemImportDraft
303     * @return builder
304     */
305    public static LineItemImportDraftBuilder builder() {
306        return LineItemImportDraftBuilder.of();
307    }
308
309    /**
310     * create builder for LineItemImportDraft instance
311     * @param template instance with prefilled values for the builder
312     * @return builder
313     */
314    public static LineItemImportDraftBuilder builder(final LineItemImportDraft template) {
315        return LineItemImportDraftBuilder.of(template);
316    }
317
318    /**
319     * accessor map function
320     * @param <T> mapped type
321     * @param helper function to map the object
322     * @return mapped value
323     */
324    default <T> T withLineItemImportDraft(Function<LineItemImportDraft, T> helper) {
325        return helper.apply(this);
326    }
327
328    /**
329     * gives a TypeReference for usage with Jackson DataBind
330     * @return TypeReference
331     */
332    public static com.fasterxml.jackson.core.type.TypeReference<LineItemImportDraft> typeReference() {
333        return new com.fasterxml.jackson.core.type.TypeReference<LineItemImportDraft>() {
334            @Override
335            public String toString() {
336                return "TypeReference<LineItemImportDraft>";
337            }
338        };
339    }
340}