001
002package com.commercetools.api.models.order_edit;
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.commercetools.api.models.cart.CustomLineItemPriceMode;
013import com.commercetools.api.models.cart.ExternalTaxRateDraft;
014import com.commercetools.api.models.common.LocalizedString;
015import com.commercetools.api.models.common.Money;
016import com.commercetools.api.models.order.StagedOrderUpdateAction;
017import com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifier;
018import com.commercetools.api.models.type.CustomFieldsDraft;
019import com.fasterxml.jackson.annotation.*;
020import com.fasterxml.jackson.databind.annotation.*;
021
022import io.vrap.rmf.base.client.utils.Generated;
023
024/**
025 * StagedOrderAddCustomLineItemAction
026 *
027 * <hr>
028 * Example to create an instance using the builder pattern
029 * <div class=code-example>
030 * <pre><code class='java'>
031 *     StagedOrderAddCustomLineItemAction stagedOrderAddCustomLineItemAction = StagedOrderAddCustomLineItemAction.builder()
032 *             .money(moneyBuilder -> moneyBuilder)
033 *             .name(nameBuilder -> nameBuilder)
034 *             .slug("{slug}")
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 = StagedOrderAddCustomLineItemActionImpl.class)
041public interface StagedOrderAddCustomLineItemAction extends StagedOrderUpdateAction,
042        com.commercetools.api.models.CustomizableDraft<StagedOrderAddCustomLineItemAction> {
043
044    /**
045     * discriminator value for StagedOrderAddCustomLineItemAction
046     */
047    String ADD_CUSTOM_LINE_ITEM = "addCustomLineItem";
048
049    /**
050     *  <p>Draft type that stores amounts only in cent precision for the specified currency.</p>
051     * @return money
052     */
053    @NotNull
054    @Valid
055    @JsonProperty("money")
056    public Money getMoney();
057
058    /**
059     *  <p>JSON object where the keys are of type Locale, and the values are the strings used for the corresponding language.</p>
060     * @return name
061     */
062    @NotNull
063    @Valid
064    @JsonProperty("name")
065    public LocalizedString getName();
066
067    /**
068     *  <p>User-defined unique identifier of the Custom Line Item.</p>
069     * @return key
070     */
071
072    @JsonProperty("key")
073    public String getKey();
074
075    /**
076     *
077     * @return quantity
078     */
079
080    @JsonProperty("quantity")
081    public Long getQuantity();
082
083    /**
084     *
085     * @return slug
086     */
087    @NotNull
088    @JsonProperty("slug")
089    public String getSlug();
090
091    /**
092     *  <p>ResourceIdentifier to a TaxCategory.</p>
093     * @return taxCategory
094     */
095    @Valid
096    @JsonProperty("taxCategory")
097    public TaxCategoryResourceIdentifier getTaxCategory();
098
099    /**
100     *  <p>The representation used when creating or updating a customizable data type with Custom Fields.</p>
101     * @return custom
102     */
103    @Valid
104    @JsonProperty("custom")
105    public CustomFieldsDraft getCustom();
106
107    /**
108     *  <p>Controls calculation of taxed prices for Line Items, Custom Line Items, and Shipping Methods as explained in Cart tax calculation.</p>
109     * @return externalTaxRate
110     */
111    @Valid
112    @JsonProperty("externalTaxRate")
113    public ExternalTaxRateDraft getExternalTaxRate();
114
115    /**
116     *  <ul>
117     *   <li>If <code>Standard</code>, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.</li>
118     *   <li>If <code>External</code>, Cart Discounts are not considered on the Custom Line Item.</li>
119     *  </ul>
120     * @return priceMode
121     */
122
123    @JsonProperty("priceMode")
124    public CustomLineItemPriceMode getPriceMode();
125
126    /**
127     *  <p>Draft type that stores amounts only in cent precision for the specified currency.</p>
128     * @param money value to be set
129     */
130
131    public void setMoney(final Money money);
132
133    /**
134     *  <p>JSON object where the keys are of type Locale, and the values are the strings used for the corresponding language.</p>
135     * @param name value to be set
136     */
137
138    public void setName(final LocalizedString name);
139
140    /**
141     *  <p>User-defined unique identifier of the Custom Line Item.</p>
142     * @param key value to be set
143     */
144
145    public void setKey(final String key);
146
147    /**
148     * set quantity
149     * @param quantity value to be set
150     */
151
152    public void setQuantity(final Long quantity);
153
154    /**
155     * set slug
156     * @param slug value to be set
157     */
158
159    public void setSlug(final String slug);
160
161    /**
162     *  <p>ResourceIdentifier to a TaxCategory.</p>
163     * @param taxCategory value to be set
164     */
165
166    public void setTaxCategory(final TaxCategoryResourceIdentifier taxCategory);
167
168    /**
169     *  <p>The representation used when creating or updating a customizable data type with Custom Fields.</p>
170     * @param custom value to be set
171     */
172
173    public void setCustom(final CustomFieldsDraft custom);
174
175    /**
176     *  <p>Controls calculation of taxed prices for Line Items, Custom Line Items, and Shipping Methods as explained in Cart tax calculation.</p>
177     * @param externalTaxRate value to be set
178     */
179
180    public void setExternalTaxRate(final ExternalTaxRateDraft externalTaxRate);
181
182    /**
183     *  <ul>
184     *   <li>If <code>Standard</code>, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.</li>
185     *   <li>If <code>External</code>, Cart Discounts are not considered on the Custom Line Item.</li>
186     *  </ul>
187     * @param priceMode value to be set
188     */
189
190    public void setPriceMode(final CustomLineItemPriceMode priceMode);
191
192    /**
193     * factory method
194     * @return instance of StagedOrderAddCustomLineItemAction
195     */
196    public static StagedOrderAddCustomLineItemAction of() {
197        return new StagedOrderAddCustomLineItemActionImpl();
198    }
199
200    /**
201     * factory method to create a shallow copy StagedOrderAddCustomLineItemAction
202     * @param template instance to be copied
203     * @return copy instance
204     */
205    public static StagedOrderAddCustomLineItemAction of(final StagedOrderAddCustomLineItemAction template) {
206        StagedOrderAddCustomLineItemActionImpl instance = new StagedOrderAddCustomLineItemActionImpl();
207        instance.setMoney(template.getMoney());
208        instance.setName(template.getName());
209        instance.setKey(template.getKey());
210        instance.setQuantity(template.getQuantity());
211        instance.setSlug(template.getSlug());
212        instance.setTaxCategory(template.getTaxCategory());
213        instance.setCustom(template.getCustom());
214        instance.setExternalTaxRate(template.getExternalTaxRate());
215        instance.setPriceMode(template.getPriceMode());
216        return instance;
217    }
218
219    /**
220     * factory method to create a deep copy of StagedOrderAddCustomLineItemAction
221     * @param template instance to be copied
222     * @return copy instance
223     */
224    @Nullable
225    public static StagedOrderAddCustomLineItemAction deepCopy(
226            @Nullable final StagedOrderAddCustomLineItemAction template) {
227        if (template == null) {
228            return null;
229        }
230        StagedOrderAddCustomLineItemActionImpl instance = new StagedOrderAddCustomLineItemActionImpl();
231        instance.setMoney(com.commercetools.api.models.common.Money.deepCopy(template.getMoney()));
232        instance.setName(com.commercetools.api.models.common.LocalizedString.deepCopy(template.getName()));
233        instance.setKey(template.getKey());
234        instance.setQuantity(template.getQuantity());
235        instance.setSlug(template.getSlug());
236        instance.setTaxCategory(com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifier
237                .deepCopy(template.getTaxCategory()));
238        instance.setCustom(com.commercetools.api.models.type.CustomFieldsDraft.deepCopy(template.getCustom()));
239        instance.setExternalTaxRate(
240            com.commercetools.api.models.cart.ExternalTaxRateDraft.deepCopy(template.getExternalTaxRate()));
241        instance.setPriceMode(template.getPriceMode());
242        return instance;
243    }
244
245    /**
246     * builder factory method for StagedOrderAddCustomLineItemAction
247     * @return builder
248     */
249    public static StagedOrderAddCustomLineItemActionBuilder builder() {
250        return StagedOrderAddCustomLineItemActionBuilder.of();
251    }
252
253    /**
254     * create builder for StagedOrderAddCustomLineItemAction instance
255     * @param template instance with prefilled values for the builder
256     * @return builder
257     */
258    public static StagedOrderAddCustomLineItemActionBuilder builder(final StagedOrderAddCustomLineItemAction template) {
259        return StagedOrderAddCustomLineItemActionBuilder.of(template);
260    }
261
262    /**
263     * accessor map function
264     * @param <T> mapped type
265     * @param helper function to map the object
266     * @return mapped value
267     */
268    default <T> T withStagedOrderAddCustomLineItemAction(Function<StagedOrderAddCustomLineItemAction, T> helper) {
269        return helper.apply(this);
270    }
271
272    /**
273     * gives a TypeReference for usage with Jackson DataBind
274     * @return TypeReference
275     */
276    public static com.fasterxml.jackson.core.type.TypeReference<StagedOrderAddCustomLineItemAction> typeReference() {
277        return new com.fasterxml.jackson.core.type.TypeReference<StagedOrderAddCustomLineItemAction>() {
278            @Override
279            public String toString() {
280                return "TypeReference<StagedOrderAddCustomLineItemAction>";
281            }
282        };
283    }
284}