001
002package com.commercetools.api.models.error;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.constraints.NotNull;
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>Returned when Line Item or Custom Line Item quantities set under ItemShippingDetails do not match the sum of the quantities in their respective shipping details.</p>
018 *  <p>The error is returned as a failed response to the Create Order from Cart and Create Order in Store from Cart requests.</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 *     GraphQLInvalidItemShippingDetailsError graphQLInvalidItemShippingDetailsError = GraphQLInvalidItemShippingDetailsError.builder()
025 *             .subject("{subject}")
026 *             .itemId("{itemId}")
027 *             .build()
028 * </code></pre>
029 * </div>
030 */
031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
032@JsonDeserialize(as = GraphQLInvalidItemShippingDetailsErrorImpl.class)
033public interface GraphQLInvalidItemShippingDetailsError extends GraphQLErrorObject {
034
035    /**
036     * discriminator value for GraphQLInvalidItemShippingDetailsError
037     */
038    String INVALID_ITEM_SHIPPING_DETAILS = "InvalidItemShippingDetails";
039
040    /**
041     *
042     * @return code
043     */
044    @NotNull
045    @JsonProperty("code")
046    public String getCode();
047
048    /**
049     *  <p><code>"LineItem"</code> or <code>"CustomLineItem"</code></p>
050     * @return subject
051     */
052    @NotNull
053    @JsonProperty("subject")
054    public String getSubject();
055
056    /**
057     *  <p>Unique identifier of the Line Item or Custom Line Item.</p>
058     * @return itemId
059     */
060    @NotNull
061    @JsonProperty("itemId")
062    public String getItemId();
063
064    /**
065     *  <p><code>"LineItem"</code> or <code>"CustomLineItem"</code></p>
066     * @param subject value to be set
067     */
068
069    public void setSubject(final String subject);
070
071    /**
072     *  <p>Unique identifier of the Line Item or Custom Line Item.</p>
073     * @param itemId value to be set
074     */
075
076    public void setItemId(final String itemId);
077
078    /**
079     * factory method
080     * @return instance of GraphQLInvalidItemShippingDetailsError
081     */
082    public static GraphQLInvalidItemShippingDetailsError of() {
083        return new GraphQLInvalidItemShippingDetailsErrorImpl();
084    }
085
086    /**
087     * factory method to create a shallow copy GraphQLInvalidItemShippingDetailsError
088     * @param template instance to be copied
089     * @return copy instance
090     */
091    public static GraphQLInvalidItemShippingDetailsError of(final GraphQLInvalidItemShippingDetailsError template) {
092        GraphQLInvalidItemShippingDetailsErrorImpl instance = new GraphQLInvalidItemShippingDetailsErrorImpl();
093        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
094        instance.setSubject(template.getSubject());
095        instance.setItemId(template.getItemId());
096        return instance;
097    }
098
099    /**
100     * factory method to create a deep copy of GraphQLInvalidItemShippingDetailsError
101     * @param template instance to be copied
102     * @return copy instance
103     */
104    @Nullable
105    public static GraphQLInvalidItemShippingDetailsError deepCopy(
106            @Nullable final GraphQLInvalidItemShippingDetailsError template) {
107        if (template == null) {
108            return null;
109        }
110        GraphQLInvalidItemShippingDetailsErrorImpl instance = new GraphQLInvalidItemShippingDetailsErrorImpl();
111        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
112        instance.setSubject(template.getSubject());
113        instance.setItemId(template.getItemId());
114        return instance;
115    }
116
117    /**
118     * builder factory method for GraphQLInvalidItemShippingDetailsError
119     * @return builder
120     */
121    public static GraphQLInvalidItemShippingDetailsErrorBuilder builder() {
122        return GraphQLInvalidItemShippingDetailsErrorBuilder.of();
123    }
124
125    /**
126     * create builder for GraphQLInvalidItemShippingDetailsError instance
127     * @param template instance with prefilled values for the builder
128     * @return builder
129     */
130    public static GraphQLInvalidItemShippingDetailsErrorBuilder builder(
131            final GraphQLInvalidItemShippingDetailsError template) {
132        return GraphQLInvalidItemShippingDetailsErrorBuilder.of(template);
133    }
134
135    /**
136     * accessor map function
137     * @param <T> mapped type
138     * @param helper function to map the object
139     * @return mapped value
140     */
141    default <T> T withGraphQLInvalidItemShippingDetailsError(
142            Function<GraphQLInvalidItemShippingDetailsError, T> helper) {
143        return helper.apply(this);
144    }
145
146    /**
147     * gives a TypeReference for usage with Jackson DataBind
148     * @return TypeReference
149     */
150    public static com.fasterxml.jackson.core.type.TypeReference<GraphQLInvalidItemShippingDetailsError> typeReference() {
151        return new com.fasterxml.jackson.core.type.TypeReference<GraphQLInvalidItemShippingDetailsError>() {
152            @Override
153            public String toString() {
154                return "TypeReference<GraphQLInvalidItemShippingDetailsError>";
155            }
156        };
157    }
158}