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.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 * OrderImportCustomLineItemStateAction
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     OrderImportCustomLineItemStateAction orderImportCustomLineItemStateAction = OrderImportCustomLineItemStateAction.builder()
026 *             .customLineItemId("{customLineItemId}")
027 *             .plusState(stateBuilder -> stateBuilder)
028 *             .build()
029 * </code></pre>
030 * </div>
031 */
032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
033@JsonDeserialize(as = OrderImportCustomLineItemStateActionImpl.class)
034public interface OrderImportCustomLineItemStateAction extends OrderUpdateAction {
035
036    /**
037     * discriminator value for OrderImportCustomLineItemStateAction
038     */
039    String IMPORT_CUSTOM_LINE_ITEM_STATE = "importCustomLineItemState";
040
041    /**
042     *
043     * @return customLineItemId
044     */
045    @NotNull
046    @JsonProperty("customLineItemId")
047    public String getCustomLineItemId();
048
049    /**
050     *
051     * @return state
052     */
053    @NotNull
054    @Valid
055    @JsonProperty("state")
056    public List<ItemState> getState();
057
058    /**
059     * set customLineItemId
060     * @param customLineItemId value to be set
061     */
062
063    public void setCustomLineItemId(final String customLineItemId);
064
065    /**
066     * set state
067     * @param state values to be set
068     */
069
070    @JsonIgnore
071    public void setState(final ItemState... state);
072
073    /**
074     * set state
075     * @param state values to be set
076     */
077
078    public void setState(final List<ItemState> state);
079
080    /**
081     * factory method
082     * @return instance of OrderImportCustomLineItemStateAction
083     */
084    public static OrderImportCustomLineItemStateAction of() {
085        return new OrderImportCustomLineItemStateActionImpl();
086    }
087
088    /**
089     * factory method to create a shallow copy OrderImportCustomLineItemStateAction
090     * @param template instance to be copied
091     * @return copy instance
092     */
093    public static OrderImportCustomLineItemStateAction of(final OrderImportCustomLineItemStateAction template) {
094        OrderImportCustomLineItemStateActionImpl instance = new OrderImportCustomLineItemStateActionImpl();
095        instance.setCustomLineItemId(template.getCustomLineItemId());
096        instance.setState(template.getState());
097        return instance;
098    }
099
100    /**
101     * factory method to create a deep copy of OrderImportCustomLineItemStateAction
102     * @param template instance to be copied
103     * @return copy instance
104     */
105    @Nullable
106    public static OrderImportCustomLineItemStateAction deepCopy(
107            @Nullable final OrderImportCustomLineItemStateAction template) {
108        if (template == null) {
109            return null;
110        }
111        OrderImportCustomLineItemStateActionImpl instance = new OrderImportCustomLineItemStateActionImpl();
112        instance.setCustomLineItemId(template.getCustomLineItemId());
113        instance.setState(Optional.ofNullable(template.getState())
114                .map(t -> t.stream()
115                        .map(com.commercetools.api.models.order.ItemState::deepCopy)
116                        .collect(Collectors.toList()))
117                .orElse(null));
118        return instance;
119    }
120
121    /**
122     * builder factory method for OrderImportCustomLineItemStateAction
123     * @return builder
124     */
125    public static OrderImportCustomLineItemStateActionBuilder builder() {
126        return OrderImportCustomLineItemStateActionBuilder.of();
127    }
128
129    /**
130     * create builder for OrderImportCustomLineItemStateAction instance
131     * @param template instance with prefilled values for the builder
132     * @return builder
133     */
134    public static OrderImportCustomLineItemStateActionBuilder builder(
135            final OrderImportCustomLineItemStateAction template) {
136        return OrderImportCustomLineItemStateActionBuilder.of(template);
137    }
138
139    /**
140     * accessor map function
141     * @param <T> mapped type
142     * @param helper function to map the object
143     * @return mapped value
144     */
145    default <T> T withOrderImportCustomLineItemStateAction(Function<OrderImportCustomLineItemStateAction, T> helper) {
146        return helper.apply(this);
147    }
148
149    /**
150     * gives a TypeReference for usage with Jackson DataBind
151     * @return TypeReference
152     */
153    public static com.fasterxml.jackson.core.type.TypeReference<OrderImportCustomLineItemStateAction> typeReference() {
154        return new com.fasterxml.jackson.core.type.TypeReference<OrderImportCustomLineItemStateAction>() {
155            @Override
156            public String toString() {
157                return "TypeReference<OrderImportCustomLineItemStateAction>";
158            }
159        };
160    }
161}