001
002package com.commercetools.api.models.error;
003
004import java.time.*;
005import java.util.*;
006
007import com.fasterxml.jackson.annotation.JsonCreator;
008import com.fasterxml.jackson.annotation.JsonProperty;
009import com.fasterxml.jackson.databind.annotation.*;
010
011import io.vrap.rmf.base.client.ModelBase;
012import io.vrap.rmf.base.client.utils.Generated;
013
014import org.apache.commons.lang3.builder.EqualsBuilder;
015import org.apache.commons.lang3.builder.HashCodeBuilder;
016
017/**
018 *  <p>Returned when the Product Variant does not have a Price according to the Product <code>priceMode</code> value for a selected currency, country, Customer Group, or Channel.</p>
019 *  <p>The error is returned as a failed response to:</p>
020 *  <ul>
021 *   <li>Add LineItem, Add CustomLineItem, and Add DiscountCode update actions on Carts.</li>
022 *   <li>Add LineItem, Add CustomLineItem, and Add DiscountCode update actions on Order Edits.</li>
023 *   <li>Create Order from Cart and Create Order in Store from Cart requests on Orders.</li>
024 *   <li>Create Order from Cart and Create Order in Store from Cart requests on My Orders.</li>
025 *  </ul>
026 */
027@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
028public class GraphQLMatchingPriceNotFoundErrorImpl implements GraphQLMatchingPriceNotFoundError, ModelBase {
029
030    private String code;
031
032    private Map<String, java.lang.Object> values;
033
034    private String productId;
035
036    private Integer variantId;
037
038    private String currency;
039
040    private String country;
041
042    private com.commercetools.api.models.customer_group.CustomerGroupReference customerGroup;
043
044    private com.commercetools.api.models.channel.ChannelReference channel;
045
046    /**
047     * create instance with all properties
048     */
049    @JsonCreator
050    GraphQLMatchingPriceNotFoundErrorImpl(@JsonProperty("values") final Map<String, java.lang.Object> values,
051            @JsonProperty("productId") final String productId, @JsonProperty("variantId") final Integer variantId,
052            @JsonProperty("currency") final String currency, @JsonProperty("country") final String country,
053            @JsonProperty("customerGroup") final com.commercetools.api.models.customer_group.CustomerGroupReference customerGroup,
054            @JsonProperty("channel") final com.commercetools.api.models.channel.ChannelReference channel) {
055        this.values = values;
056        this.productId = productId;
057        this.variantId = variantId;
058        this.currency = currency;
059        this.country = country;
060        this.customerGroup = customerGroup;
061        this.channel = channel;
062        this.code = MATCHING_PRICE_NOT_FOUND;
063    }
064
065    /**
066     * create empty instance
067     */
068    public GraphQLMatchingPriceNotFoundErrorImpl() {
069        this.code = MATCHING_PRICE_NOT_FOUND;
070    }
071
072    /**
073     *
074     */
075
076    public String getCode() {
077        return this.code;
078    }
079
080    /**
081     *  <p>Error-specific additional fields.</p>
082     */
083
084    public Map<String, java.lang.Object> values() {
085        return values;
086    }
087
088    /**
089     *  <p>Unique identifier of a Product.</p>
090     */
091
092    public String getProductId() {
093        return this.productId;
094    }
095
096    /**
097     *  <p>Unique identifier of a ProductVariant in the Product.</p>
098     */
099
100    public Integer getVariantId() {
101        return this.variantId;
102    }
103
104    /**
105     *  <p>Currency code of the country.</p>
106     */
107
108    public String getCurrency() {
109        return this.currency;
110    }
111
112    /**
113     *  <p>Country code of the geographic location.</p>
114     */
115
116    public String getCountry() {
117        return this.country;
118    }
119
120    /**
121     *  <p>Customer Group associated with the Price.</p>
122     */
123
124    public com.commercetools.api.models.customer_group.CustomerGroupReference getCustomerGroup() {
125        return this.customerGroup;
126    }
127
128    /**
129     *  <p>Channel associated with the Price.</p>
130     */
131
132    public com.commercetools.api.models.channel.ChannelReference getChannel() {
133        return this.channel;
134    }
135
136    public void setValue(String key, java.lang.Object value) {
137        if (values == null) {
138            values = new HashMap<>();
139        }
140        values.put(key, value);
141    }
142
143    public void setProductId(final String productId) {
144        this.productId = productId;
145    }
146
147    public void setVariantId(final Integer variantId) {
148        this.variantId = variantId;
149    }
150
151    public void setCurrency(final String currency) {
152        this.currency = currency;
153    }
154
155    public void setCountry(final String country) {
156        this.country = country;
157    }
158
159    public void setCustomerGroup(
160            final com.commercetools.api.models.customer_group.CustomerGroupReference customerGroup) {
161        this.customerGroup = customerGroup;
162    }
163
164    public void setChannel(final com.commercetools.api.models.channel.ChannelReference channel) {
165        this.channel = channel;
166    }
167
168    @Override
169    public boolean equals(Object o) {
170        if (this == o)
171            return true;
172
173        if (o == null || getClass() != o.getClass())
174            return false;
175
176        GraphQLMatchingPriceNotFoundErrorImpl that = (GraphQLMatchingPriceNotFoundErrorImpl) o;
177
178        return new EqualsBuilder().append(code, that.code)
179                .append(values, that.values)
180                .append(productId, that.productId)
181                .append(variantId, that.variantId)
182                .append(currency, that.currency)
183                .append(country, that.country)
184                .append(customerGroup, that.customerGroup)
185                .append(channel, that.channel)
186                .append(code, that.code)
187                .append(values, that.values)
188                .append(productId, that.productId)
189                .append(variantId, that.variantId)
190                .append(currency, that.currency)
191                .append(country, that.country)
192                .append(customerGroup, that.customerGroup)
193                .append(channel, that.channel)
194                .isEquals();
195    }
196
197    @Override
198    public int hashCode() {
199        return new HashCodeBuilder(17, 37).append(code)
200                .append(values)
201                .append(productId)
202                .append(variantId)
203                .append(currency)
204                .append(country)
205                .append(customerGroup)
206                .append(channel)
207                .toHashCode();
208    }
209
210}