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.commercetools.api.models.channel.ChannelResourceIdentifier;
012import com.fasterxml.jackson.annotation.*;
013import com.fasterxml.jackson.databind.annotation.*;
014
015import io.vrap.rmf.base.client.utils.Generated;
016
017/**
018 *  <p>Performing this action has no impact on inventory that should be reserved.</p>
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     CartSetLineItemSupplyChannelAction cartSetLineItemSupplyChannelAction = CartSetLineItemSupplyChannelAction.builder()
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
030@JsonDeserialize(as = CartSetLineItemSupplyChannelActionImpl.class)
031public interface CartSetLineItemSupplyChannelAction extends CartUpdateAction {
032
033    /**
034     * discriminator value for CartSetLineItemSupplyChannelAction
035     */
036    String SET_LINE_ITEM_SUPPLY_CHANNEL = "setLineItemSupplyChannel";
037
038    /**
039     *  <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
040     * @return lineItemId
041     */
042
043    @JsonProperty("lineItemId")
044    public String getLineItemId();
045
046    /**
047     *  <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
048     * @return lineItemKey
049     */
050
051    @JsonProperty("lineItemKey")
052    public String getLineItemKey();
053
054    /**
055     *  <ul>
056     *   <li>If present, a Reference to the Channel is set for the LineItem specified by <code>lineItemId</code>.</li>
057     *   <li>If not present, the current Reference to a supply channel will be removed from the LineItem specified by <code>lineItemId</code>. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</li>
058     *  </ul>
059     * @return supplyChannel
060     */
061    @Valid
062    @JsonProperty("supplyChannel")
063    public ChannelResourceIdentifier getSupplyChannel();
064
065    /**
066     *  <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
067     * @param lineItemId value to be set
068     */
069
070    public void setLineItemId(final String lineItemId);
071
072    /**
073     *  <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p>
074     * @param lineItemKey value to be set
075     */
076
077    public void setLineItemKey(final String lineItemKey);
078
079    /**
080     *  <ul>
081     *   <li>If present, a Reference to the Channel is set for the LineItem specified by <code>lineItemId</code>.</li>
082     *   <li>If not present, the current Reference to a supply channel will be removed from the LineItem specified by <code>lineItemId</code>. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</li>
083     *  </ul>
084     * @param supplyChannel value to be set
085     */
086
087    public void setSupplyChannel(final ChannelResourceIdentifier supplyChannel);
088
089    /**
090     * factory method
091     * @return instance of CartSetLineItemSupplyChannelAction
092     */
093    public static CartSetLineItemSupplyChannelAction of() {
094        return new CartSetLineItemSupplyChannelActionImpl();
095    }
096
097    /**
098     * factory method to create a shallow copy CartSetLineItemSupplyChannelAction
099     * @param template instance to be copied
100     * @return copy instance
101     */
102    public static CartSetLineItemSupplyChannelAction of(final CartSetLineItemSupplyChannelAction template) {
103        CartSetLineItemSupplyChannelActionImpl instance = new CartSetLineItemSupplyChannelActionImpl();
104        instance.setLineItemId(template.getLineItemId());
105        instance.setLineItemKey(template.getLineItemKey());
106        instance.setSupplyChannel(template.getSupplyChannel());
107        return instance;
108    }
109
110    /**
111     * factory method to create a deep copy of CartSetLineItemSupplyChannelAction
112     * @param template instance to be copied
113     * @return copy instance
114     */
115    @Nullable
116    public static CartSetLineItemSupplyChannelAction deepCopy(
117            @Nullable final CartSetLineItemSupplyChannelAction template) {
118        if (template == null) {
119            return null;
120        }
121        CartSetLineItemSupplyChannelActionImpl instance = new CartSetLineItemSupplyChannelActionImpl();
122        instance.setLineItemId(template.getLineItemId());
123        instance.setLineItemKey(template.getLineItemKey());
124        instance.setSupplyChannel(
125            com.commercetools.api.models.channel.ChannelResourceIdentifier.deepCopy(template.getSupplyChannel()));
126        return instance;
127    }
128
129    /**
130     * builder factory method for CartSetLineItemSupplyChannelAction
131     * @return builder
132     */
133    public static CartSetLineItemSupplyChannelActionBuilder builder() {
134        return CartSetLineItemSupplyChannelActionBuilder.of();
135    }
136
137    /**
138     * create builder for CartSetLineItemSupplyChannelAction instance
139     * @param template instance with prefilled values for the builder
140     * @return builder
141     */
142    public static CartSetLineItemSupplyChannelActionBuilder builder(final CartSetLineItemSupplyChannelAction template) {
143        return CartSetLineItemSupplyChannelActionBuilder.of(template);
144    }
145
146    /**
147     * accessor map function
148     * @param <T> mapped type
149     * @param helper function to map the object
150     * @return mapped value
151     */
152    default <T> T withCartSetLineItemSupplyChannelAction(Function<CartSetLineItemSupplyChannelAction, T> helper) {
153        return helper.apply(this);
154    }
155
156    /**
157     * gives a TypeReference for usage with Jackson DataBind
158     * @return TypeReference
159     */
160    public static com.fasterxml.jackson.core.type.TypeReference<CartSetLineItemSupplyChannelAction> typeReference() {
161        return new com.fasterxml.jackson.core.type.TypeReference<CartSetLineItemSupplyChannelAction>() {
162            @Override
163            public String toString() {
164                return "TypeReference<CartSetLineItemSupplyChannelAction>";
165            }
166        };
167    }
168}