001
002package com.commercetools.api.models.cart;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 *  <p>Can be used if the Cart has the <code>ExternalAmount</code> TaxMode.</p>
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     CartSetLineItemTaxAmountAction cartSetLineItemTaxAmountAction = CartSetLineItemTaxAmountAction.builder()
024 *             .build()
025 * </code></pre>
026 * </div>
027 */
028@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
029@JsonDeserialize(as = CartSetLineItemTaxAmountActionImpl.class)
030public interface CartSetLineItemTaxAmountAction extends CartUpdateAction {
031
032    /**
033     * discriminator value for CartSetLineItemTaxAmountAction
034     */
035    String SET_LINE_ITEM_TAX_AMOUNT = "setLineItemTaxAmount";
036
037    /**
038     *  <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
039     * @return lineItemId
040     */
041
042    @JsonProperty("lineItemId")
043    public String getLineItemId();
044
045    /**
046     *  <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
047     * @return lineItemKey
048     */
049
050    @JsonProperty("lineItemKey")
051    public String getLineItemKey();
052
053    /**
054     *  <p>Value to set. If empty, any existing value is removed.</p>
055     * @return externalTaxAmount
056     */
057    @Valid
058    @JsonProperty("externalTaxAmount")
059    public ExternalTaxAmountDraft getExternalTaxAmount();
060
061    /**
062     *  <p><code>key</code> of the ShippingMethod used for this Line Item. This is required for Carts with <code>Multiple</code> ShippingMode.</p>
063     * @return shippingKey
064     */
065
066    @JsonProperty("shippingKey")
067    public String getShippingKey();
068
069    /**
070     *  <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
071     * @param lineItemId value to be set
072     */
073
074    public void setLineItemId(final String lineItemId);
075
076    /**
077     *  <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
078     * @param lineItemKey value to be set
079     */
080
081    public void setLineItemKey(final String lineItemKey);
082
083    /**
084     *  <p>Value to set. If empty, any existing value is removed.</p>
085     * @param externalTaxAmount value to be set
086     */
087
088    public void setExternalTaxAmount(final ExternalTaxAmountDraft externalTaxAmount);
089
090    /**
091     *  <p><code>key</code> of the ShippingMethod used for this Line Item. This is required for Carts with <code>Multiple</code> ShippingMode.</p>
092     * @param shippingKey value to be set
093     */
094
095    public void setShippingKey(final String shippingKey);
096
097    /**
098     * factory method
099     * @return instance of CartSetLineItemTaxAmountAction
100     */
101    public static CartSetLineItemTaxAmountAction of() {
102        return new CartSetLineItemTaxAmountActionImpl();
103    }
104
105    /**
106     * factory method to create a shallow copy CartSetLineItemTaxAmountAction
107     * @param template instance to be copied
108     * @return copy instance
109     */
110    public static CartSetLineItemTaxAmountAction of(final CartSetLineItemTaxAmountAction template) {
111        CartSetLineItemTaxAmountActionImpl instance = new CartSetLineItemTaxAmountActionImpl();
112        instance.setLineItemId(template.getLineItemId());
113        instance.setLineItemKey(template.getLineItemKey());
114        instance.setExternalTaxAmount(template.getExternalTaxAmount());
115        instance.setShippingKey(template.getShippingKey());
116        return instance;
117    }
118
119    /**
120     * factory method to create a deep copy of CartSetLineItemTaxAmountAction
121     * @param template instance to be copied
122     * @return copy instance
123     */
124    @Nullable
125    public static CartSetLineItemTaxAmountAction deepCopy(@Nullable final CartSetLineItemTaxAmountAction template) {
126        if (template == null) {
127            return null;
128        }
129        CartSetLineItemTaxAmountActionImpl instance = new CartSetLineItemTaxAmountActionImpl();
130        instance.setLineItemId(template.getLineItemId());
131        instance.setLineItemKey(template.getLineItemKey());
132        instance.setExternalTaxAmount(
133            com.commercetools.api.models.cart.ExternalTaxAmountDraft.deepCopy(template.getExternalTaxAmount()));
134        instance.setShippingKey(template.getShippingKey());
135        return instance;
136    }
137
138    /**
139     * builder factory method for CartSetLineItemTaxAmountAction
140     * @return builder
141     */
142    public static CartSetLineItemTaxAmountActionBuilder builder() {
143        return CartSetLineItemTaxAmountActionBuilder.of();
144    }
145
146    /**
147     * create builder for CartSetLineItemTaxAmountAction instance
148     * @param template instance with prefilled values for the builder
149     * @return builder
150     */
151    public static CartSetLineItemTaxAmountActionBuilder builder(final CartSetLineItemTaxAmountAction template) {
152        return CartSetLineItemTaxAmountActionBuilder.of(template);
153    }
154
155    /**
156     * accessor map function
157     * @param <T> mapped type
158     * @param helper function to map the object
159     * @return mapped value
160     */
161    default <T> T withCartSetLineItemTaxAmountAction(Function<CartSetLineItemTaxAmountAction, T> helper) {
162        return helper.apply(this);
163    }
164
165    /**
166     * gives a TypeReference for usage with Jackson DataBind
167     * @return TypeReference
168     */
169    public static com.fasterxml.jackson.core.type.TypeReference<CartSetLineItemTaxAmountAction> typeReference() {
170        return new com.fasterxml.jackson.core.type.TypeReference<CartSetLineItemTaxAmountAction>() {
171            @Override
172            public String toString() {
173                return "TypeReference<CartSetLineItemTaxAmountAction>";
174            }
175        };
176    }
177}