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.Valid;
010import javax.validation.constraints.NotNull;
011
012import com.commercetools.api.models.common.Price;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 *  <p>Returned when a Price scope conflicts with an existing one during an Update Product request.</p>
020 *  <p>Every Price of a Product Variant must have a distinct combination of currency, Customer Group, country, and Channel that constitute the scope of a Price.</p>
021 *
022 * <hr>
023 * Example to create an instance using the builder pattern
024 * <div class=code-example>
025 * <pre><code class='java'>
026 *     GraphQLDuplicatePriceScopeError graphQLDuplicatePriceScopeError = GraphQLDuplicatePriceScopeError.builder()
027 *             .conflictingPrice(conflictingPriceBuilder -> conflictingPriceBuilder)
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 = GraphQLDuplicatePriceScopeErrorImpl.class)
034public interface GraphQLDuplicatePriceScopeError extends GraphQLErrorObject {
035
036    /**
037     * discriminator value for GraphQLDuplicatePriceScopeError
038     */
039    String DUPLICATE_PRICE_SCOPE = "DuplicatePriceScope";
040
041    /**
042     *
043     * @return code
044     */
045    @NotNull
046    @JsonProperty("code")
047    public String getCode();
048
049    /**
050     *  <p>Conflicting Embedded Price.</p>
051     * @return conflictingPrice
052     */
053    @NotNull
054    @Valid
055    @JsonProperty("conflictingPrice")
056    public Price getConflictingPrice();
057
058    /**
059     *  <p>Conflicting Embedded Price.</p>
060     * @param conflictingPrice value to be set
061     */
062
063    public void setConflictingPrice(final Price conflictingPrice);
064
065    /**
066     * factory method
067     * @return instance of GraphQLDuplicatePriceScopeError
068     */
069    public static GraphQLDuplicatePriceScopeError of() {
070        return new GraphQLDuplicatePriceScopeErrorImpl();
071    }
072
073    /**
074     * factory method to create a shallow copy GraphQLDuplicatePriceScopeError
075     * @param template instance to be copied
076     * @return copy instance
077     */
078    public static GraphQLDuplicatePriceScopeError of(final GraphQLDuplicatePriceScopeError template) {
079        GraphQLDuplicatePriceScopeErrorImpl instance = new GraphQLDuplicatePriceScopeErrorImpl();
080        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
081        instance.setConflictingPrice(template.getConflictingPrice());
082        return instance;
083    }
084
085    /**
086     * factory method to create a deep copy of GraphQLDuplicatePriceScopeError
087     * @param template instance to be copied
088     * @return copy instance
089     */
090    @Nullable
091    public static GraphQLDuplicatePriceScopeError deepCopy(@Nullable final GraphQLDuplicatePriceScopeError template) {
092        if (template == null) {
093            return null;
094        }
095        GraphQLDuplicatePriceScopeErrorImpl instance = new GraphQLDuplicatePriceScopeErrorImpl();
096        Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue));
097        instance.setConflictingPrice(
098            com.commercetools.api.models.common.Price.deepCopy(template.getConflictingPrice()));
099        return instance;
100    }
101
102    /**
103     * builder factory method for GraphQLDuplicatePriceScopeError
104     * @return builder
105     */
106    public static GraphQLDuplicatePriceScopeErrorBuilder builder() {
107        return GraphQLDuplicatePriceScopeErrorBuilder.of();
108    }
109
110    /**
111     * create builder for GraphQLDuplicatePriceScopeError instance
112     * @param template instance with prefilled values for the builder
113     * @return builder
114     */
115    public static GraphQLDuplicatePriceScopeErrorBuilder builder(final GraphQLDuplicatePriceScopeError template) {
116        return GraphQLDuplicatePriceScopeErrorBuilder.of(template);
117    }
118
119    /**
120     * accessor map function
121     * @param <T> mapped type
122     * @param helper function to map the object
123     * @return mapped value
124     */
125    default <T> T withGraphQLDuplicatePriceScopeError(Function<GraphQLDuplicatePriceScopeError, T> helper) {
126        return helper.apply(this);
127    }
128
129    /**
130     * gives a TypeReference for usage with Jackson DataBind
131     * @return TypeReference
132     */
133    public static com.fasterxml.jackson.core.type.TypeReference<GraphQLDuplicatePriceScopeError> typeReference() {
134        return new com.fasterxml.jackson.core.type.TypeReference<GraphQLDuplicatePriceScopeError>() {
135            @Override
136            public String toString() {
137                return "TypeReference<GraphQLDuplicatePriceScopeError>";
138            }
139        };
140    }
141}