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 a Cart or an Order in a Store references a country that is not included in the countries configured for the Store.</p>
019 *  <p>The error is returned as a failed response to:</p>
020 *  <ul>
021 *   <li>Create Cart in Store request and Set Country update action on Carts.</li>
022 *   <li>Create Cart in Store request and Set Country update action on My Carts.</li>
023 *   <li>Create Order in Store from Cart requests on Orders.</li>
024 *   <li>Create Order in Store from Cart requests on My Orders.</li>
025 *   <li>Create Order from Quote requests on Orders.</li>
026 *   <li>Create Order from Quote requests on My Orders.</li>
027 *   <li>Create Order by Import request on Order Import.</li>
028 *   <li>Set Country on Order Edits.</li>
029 *  </ul>
030 */
031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
032public class GraphQLCountryNotConfiguredInStoreErrorImpl implements GraphQLCountryNotConfiguredInStoreError, ModelBase {
033
034    private String code;
035
036    private Map<String, java.lang.Object> values;
037
038    private java.util.List<String> storeCountries;
039
040    private String country;
041
042    /**
043     * create instance with all properties
044     */
045    @JsonCreator
046    GraphQLCountryNotConfiguredInStoreErrorImpl(@JsonProperty("values") final Map<String, java.lang.Object> values,
047            @JsonProperty("storeCountries") final java.util.List<String> storeCountries,
048            @JsonProperty("country") final String country) {
049        this.values = values;
050        this.storeCountries = storeCountries;
051        this.country = country;
052        this.code = COUNTRY_NOT_CONFIGURED_IN_STORE;
053    }
054
055    /**
056     * create empty instance
057     */
058    public GraphQLCountryNotConfiguredInStoreErrorImpl() {
059        this.code = COUNTRY_NOT_CONFIGURED_IN_STORE;
060    }
061
062    /**
063     *
064     */
065
066    public String getCode() {
067        return this.code;
068    }
069
070    /**
071     *  <p>Error-specific additional fields.</p>
072     */
073
074    public Map<String, java.lang.Object> values() {
075        return values;
076    }
077
078    /**
079     *  <p>Countries configured for the Store.</p>
080     */
081
082    public java.util.List<String> getStoreCountries() {
083        return this.storeCountries;
084    }
085
086    /**
087     *  <p>The country that is not configured for the Store but referenced on the Cart or Order.</p>
088     */
089
090    public String getCountry() {
091        return this.country;
092    }
093
094    public void setValue(String key, java.lang.Object value) {
095        if (values == null) {
096            values = new HashMap<>();
097        }
098        values.put(key, value);
099    }
100
101    public void setStoreCountries(final String... storeCountries) {
102        this.storeCountries = new ArrayList<>(Arrays.asList(storeCountries));
103    }
104
105    public void setStoreCountries(final java.util.List<String> storeCountries) {
106        this.storeCountries = storeCountries;
107    }
108
109    public void setCountry(final String country) {
110        this.country = country;
111    }
112
113    @Override
114    public boolean equals(Object o) {
115        if (this == o)
116            return true;
117
118        if (o == null || getClass() != o.getClass())
119            return false;
120
121        GraphQLCountryNotConfiguredInStoreErrorImpl that = (GraphQLCountryNotConfiguredInStoreErrorImpl) o;
122
123        return new EqualsBuilder().append(code, that.code)
124                .append(values, that.values)
125                .append(storeCountries, that.storeCountries)
126                .append(country, that.country)
127                .append(code, that.code)
128                .append(values, that.values)
129                .append(storeCountries, that.storeCountries)
130                .append(country, that.country)
131                .isEquals();
132    }
133
134    @Override
135    public int hashCode() {
136        return new HashCodeBuilder(17, 37).append(code)
137                .append(values)
138                .append(storeCountries)
139                .append(country)
140                .toHashCode();
141    }
142
143}