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>Input used to select a ShippingRatePriceTier. If no matching tier can be found, or the input is not set, the default price for the shipping rate is used.</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 *     CartSetShippingRateInputAction cartSetShippingRateInputAction = CartSetShippingRateInputAction.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 = CartSetShippingRateInputActionImpl.class)
030public interface CartSetShippingRateInputAction extends CartUpdateAction {
031
032    /**
033     * discriminator value for CartSetShippingRateInputAction
034     */
035    String SET_SHIPPING_RATE_INPUT = "setShippingRateInput";
036
037    /**
038     *  <p>The data type of this field depends on the <code>shippingRateInputType.type</code> configured in the Project:</p>
039     *  <ul>
040     *   <li>If <code>CartClassification</code>, it must be ClassificationShippingRateInputDraft.</li>
041     *   <li>If <code>CartScore</code>, it must be ScoreShippingRateInputDraft.</li>
042     *   <li>If <code>CartValue</code>, it cannot be set.</li>
043     *  </ul>
044     * @return shippingRateInput
045     */
046    @Valid
047    @JsonProperty("shippingRateInput")
048    public ShippingRateInputDraft getShippingRateInput();
049
050    /**
051     *  <p>The data type of this field depends on the <code>shippingRateInputType.type</code> configured in the Project:</p>
052     *  <ul>
053     *   <li>If <code>CartClassification</code>, it must be ClassificationShippingRateInputDraft.</li>
054     *   <li>If <code>CartScore</code>, it must be ScoreShippingRateInputDraft.</li>
055     *   <li>If <code>CartValue</code>, it cannot be set.</li>
056     *  </ul>
057     * @param shippingRateInput value to be set
058     */
059
060    public void setShippingRateInput(final ShippingRateInputDraft shippingRateInput);
061
062    /**
063     * factory method
064     * @return instance of CartSetShippingRateInputAction
065     */
066    public static CartSetShippingRateInputAction of() {
067        return new CartSetShippingRateInputActionImpl();
068    }
069
070    /**
071     * factory method to create a shallow copy CartSetShippingRateInputAction
072     * @param template instance to be copied
073     * @return copy instance
074     */
075    public static CartSetShippingRateInputAction of(final CartSetShippingRateInputAction template) {
076        CartSetShippingRateInputActionImpl instance = new CartSetShippingRateInputActionImpl();
077        instance.setShippingRateInput(template.getShippingRateInput());
078        return instance;
079    }
080
081    /**
082     * factory method to create a deep copy of CartSetShippingRateInputAction
083     * @param template instance to be copied
084     * @return copy instance
085     */
086    @Nullable
087    public static CartSetShippingRateInputAction deepCopy(@Nullable final CartSetShippingRateInputAction template) {
088        if (template == null) {
089            return null;
090        }
091        CartSetShippingRateInputActionImpl instance = new CartSetShippingRateInputActionImpl();
092        instance.setShippingRateInput(
093            com.commercetools.api.models.cart.ShippingRateInputDraft.deepCopy(template.getShippingRateInput()));
094        return instance;
095    }
096
097    /**
098     * builder factory method for CartSetShippingRateInputAction
099     * @return builder
100     */
101    public static CartSetShippingRateInputActionBuilder builder() {
102        return CartSetShippingRateInputActionBuilder.of();
103    }
104
105    /**
106     * create builder for CartSetShippingRateInputAction instance
107     * @param template instance with prefilled values for the builder
108     * @return builder
109     */
110    public static CartSetShippingRateInputActionBuilder builder(final CartSetShippingRateInputAction template) {
111        return CartSetShippingRateInputActionBuilder.of(template);
112    }
113
114    /**
115     * accessor map function
116     * @param <T> mapped type
117     * @param helper function to map the object
118     * @return mapped value
119     */
120    default <T> T withCartSetShippingRateInputAction(Function<CartSetShippingRateInputAction, T> helper) {
121        return helper.apply(this);
122    }
123
124    public static CartSetShippingRateInputAction ofUnset() {
125        return CartSetShippingRateInputAction.of();
126    }
127
128    /**
129     * gives a TypeReference for usage with Jackson DataBind
130     * @return TypeReference
131     */
132    public static com.fasterxml.jackson.core.type.TypeReference<CartSetShippingRateInputAction> typeReference() {
133        return new com.fasterxml.jackson.core.type.TypeReference<CartSetShippingRateInputAction>() {
134            @Override
135            public String toString() {
136                return "TypeReference<CartSetShippingRateInputAction>";
137            }
138        };
139    }
140}