001
002package com.commercetools.api.models.order;
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.CartResourceIdentifier;
013import com.commercetools.api.models.state.StateResourceIdentifier;
014import com.commercetools.api.models.type.CustomFieldsDraft;
015import com.fasterxml.jackson.annotation.*;
016import com.fasterxml.jackson.databind.annotation.*;
017
018import io.vrap.rmf.base.client.utils.Generated;
019
020/**
021 * OrderFromCartDraft
022 *
023 * <hr>
024 * Example to create an instance using the builder pattern
025 * <div class=code-example>
026 * <pre><code class='java'>
027 *     OrderFromCartDraft orderFromCartDraft = OrderFromCartDraft.builder()
028 *             .version(0.3)
029 *             .build()
030 * </code></pre>
031 * </div>
032 */
033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
034@JsonDeserialize(as = OrderFromCartDraftImpl.class)
035public interface OrderFromCartDraft extends io.vrap.rmf.base.client.Draft<OrderFromCartDraft> {
036
037    /**
038     *  <p>Unique identifier of the Cart from which you can create an Order.</p>
039     * @return id
040     */
041    @Deprecated
042    @JsonProperty("id")
043    public String getId();
044
045    /**
046     *  <p>ResourceIdentifier of the Cart from which the Order is created.</p>
047     * @return cart
048     */
049    @Valid
050    @JsonProperty("cart")
051    public CartResourceIdentifier getCart();
052
053    /**
054     *  <p>Expected version of the Cart from which the Order is created. If the expected version does not match the actual version, a 409 Conflict error will be returned.</p>
055     * @return version
056     */
057    @NotNull
058    @JsonProperty("version")
059    public Long getVersion();
060
061    /**
062     *  <p>String that uniquely identifies an order. It can be used to create more human-readable (in contrast to ID) identifier for the order. It should be unique across a project. Once it's set it cannot be changed. For easier use on Get, Update and Delete actions we suggest assigning order numbers that match the regular expression <code>[a-z0-9_\-]{2,36}</code>.</p>
063     * @return orderNumber
064     */
065
066    @JsonProperty("orderNumber")
067    public String getOrderNumber();
068
069    /**
070     *  <p>Identifier for a purchase order, usually in a B2B context. The Purchase Order Number is typically entered by the Buyer and can also be used with Quotes.</p>
071     * @return purchaseOrderNumber
072     */
073
074    @JsonProperty("purchaseOrderNumber")
075    public String getPurchaseOrderNumber();
076
077    /**
078     *  <p>Payment state for the Order.</p>
079     * @return paymentState
080     */
081
082    @JsonProperty("paymentState")
083    public PaymentState getPaymentState();
084
085    /**
086     *  <p>Shipment state for the Order.</p>
087     * @return shipmentState
088     */
089
090    @JsonProperty("shipmentState")
091    public ShipmentState getShipmentState();
092
093    /**
094     *  <p>Order will be created with <code>Open</code> status by default.</p>
095     * @return orderState
096     */
097
098    @JsonProperty("orderState")
099    public OrderState getOrderState();
100
101    /**
102     *  <p>Reference to a State indicating the Order's state.</p>
103     * @return state
104     */
105    @Valid
106    @JsonProperty("state")
107    public StateResourceIdentifier getState();
108
109    /**
110     *  <p>Custom Fields for the Order. The Custom Field type must match the type of the Custom Fields in the referenced Cart. If specified, the Custom Fields are merged with the Custom Fields on the referenced Cart and added to the Order. If empty, the Custom Fields on the referenced Cart are added to the Order automatically.</p>
111     * @return custom
112     */
113    @Valid
114    @JsonProperty("custom")
115    public CustomFieldsDraft getCustom();
116
117    /**
118     *  <p>Unique identifier of the Cart from which you can create an Order.</p>
119     * @param id value to be set
120     */
121    @Deprecated
122    public void setId(final String id);
123
124    /**
125     *  <p>ResourceIdentifier of the Cart from which the Order is created.</p>
126     * @param cart value to be set
127     */
128
129    public void setCart(final CartResourceIdentifier cart);
130
131    /**
132     *  <p>Expected version of the Cart from which the Order is created. If the expected version does not match the actual version, a 409 Conflict error will be returned.</p>
133     * @param version value to be set
134     */
135
136    public void setVersion(final Long version);
137
138    /**
139     *  <p>String that uniquely identifies an order. It can be used to create more human-readable (in contrast to ID) identifier for the order. It should be unique across a project. Once it's set it cannot be changed. For easier use on Get, Update and Delete actions we suggest assigning order numbers that match the regular expression <code>[a-z0-9_\-]{2,36}</code>.</p>
140     * @param orderNumber value to be set
141     */
142
143    public void setOrderNumber(final String orderNumber);
144
145    /**
146     *  <p>Identifier for a purchase order, usually in a B2B context. The Purchase Order Number is typically entered by the Buyer and can also be used with Quotes.</p>
147     * @param purchaseOrderNumber value to be set
148     */
149
150    public void setPurchaseOrderNumber(final String purchaseOrderNumber);
151
152    /**
153     *  <p>Payment state for the Order.</p>
154     * @param paymentState value to be set
155     */
156
157    public void setPaymentState(final PaymentState paymentState);
158
159    /**
160     *  <p>Shipment state for the Order.</p>
161     * @param shipmentState value to be set
162     */
163
164    public void setShipmentState(final ShipmentState shipmentState);
165
166    /**
167     *  <p>Order will be created with <code>Open</code> status by default.</p>
168     * @param orderState value to be set
169     */
170
171    public void setOrderState(final OrderState orderState);
172
173    /**
174     *  <p>Reference to a State indicating the Order's state.</p>
175     * @param state value to be set
176     */
177
178    public void setState(final StateResourceIdentifier state);
179
180    /**
181     *  <p>Custom Fields for the Order. The Custom Field type must match the type of the Custom Fields in the referenced Cart. If specified, the Custom Fields are merged with the Custom Fields on the referenced Cart and added to the Order. If empty, the Custom Fields on the referenced Cart are added to the Order automatically.</p>
182     * @param custom value to be set
183     */
184
185    public void setCustom(final CustomFieldsDraft custom);
186
187    /**
188     * factory method
189     * @return instance of OrderFromCartDraft
190     */
191    public static OrderFromCartDraft of() {
192        return new OrderFromCartDraftImpl();
193    }
194
195    /**
196     * factory method to create a shallow copy OrderFromCartDraft
197     * @param template instance to be copied
198     * @return copy instance
199     */
200    public static OrderFromCartDraft of(final OrderFromCartDraft template) {
201        OrderFromCartDraftImpl instance = new OrderFromCartDraftImpl();
202        instance.setId(template.getId());
203        instance.setCart(template.getCart());
204        instance.setVersion(template.getVersion());
205        instance.setOrderNumber(template.getOrderNumber());
206        instance.setPurchaseOrderNumber(template.getPurchaseOrderNumber());
207        instance.setPaymentState(template.getPaymentState());
208        instance.setShipmentState(template.getShipmentState());
209        instance.setOrderState(template.getOrderState());
210        instance.setState(template.getState());
211        instance.setCustom(template.getCustom());
212        return instance;
213    }
214
215    /**
216     * factory method to create a deep copy of OrderFromCartDraft
217     * @param template instance to be copied
218     * @return copy instance
219     */
220    @Nullable
221    public static OrderFromCartDraft deepCopy(@Nullable final OrderFromCartDraft template) {
222        if (template == null) {
223            return null;
224        }
225        OrderFromCartDraftImpl instance = new OrderFromCartDraftImpl();
226        instance.setId(template.getId());
227        instance.setCart(com.commercetools.api.models.cart.CartResourceIdentifier.deepCopy(template.getCart()));
228        instance.setVersion(template.getVersion());
229        instance.setOrderNumber(template.getOrderNumber());
230        instance.setPurchaseOrderNumber(template.getPurchaseOrderNumber());
231        instance.setPaymentState(template.getPaymentState());
232        instance.setShipmentState(template.getShipmentState());
233        instance.setOrderState(template.getOrderState());
234        instance.setState(com.commercetools.api.models.state.StateResourceIdentifier.deepCopy(template.getState()));
235        instance.setCustom(com.commercetools.api.models.type.CustomFieldsDraft.deepCopy(template.getCustom()));
236        return instance;
237    }
238
239    /**
240     * builder factory method for OrderFromCartDraft
241     * @return builder
242     */
243    public static OrderFromCartDraftBuilder builder() {
244        return OrderFromCartDraftBuilder.of();
245    }
246
247    /**
248     * create builder for OrderFromCartDraft instance
249     * @param template instance with prefilled values for the builder
250     * @return builder
251     */
252    public static OrderFromCartDraftBuilder builder(final OrderFromCartDraft template) {
253        return OrderFromCartDraftBuilder.of(template);
254    }
255
256    /**
257     * accessor map function
258     * @param <T> mapped type
259     * @param helper function to map the object
260     * @return mapped value
261     */
262    default <T> T withOrderFromCartDraft(Function<OrderFromCartDraft, T> helper) {
263        return helper.apply(this);
264    }
265
266    /**
267     * gives a TypeReference for usage with Jackson DataBind
268     * @return TypeReference
269     */
270    public static com.fasterxml.jackson.core.type.TypeReference<OrderFromCartDraft> typeReference() {
271        return new com.fasterxml.jackson.core.type.TypeReference<OrderFromCartDraft>() {
272            @Override
273            public String toString() {
274                return "TypeReference<OrderFromCartDraft>";
275            }
276        };
277    }
278}