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 given Price validity period conflicts with an existing one. Every Standalone Price associated with the same SKU and with the same combination of currency, country, Customer Group, and Channel, must have non-overlapping validity periods (<code>validFrom</code> and <code>validUntil</code>).</p>
019 *  <p>The error is returned as a failed response to the Create StandalonePrice request.</p>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class OverlappingStandalonePriceValidityErrorImpl implements OverlappingStandalonePriceValidityError, ModelBase {
023
024    private String code;
025
026    private String message;
027
028    private Map<String, java.lang.Object> values;
029
030    private com.commercetools.api.models.standalone_price.StandalonePriceReference conflictingStandalonePrice;
031
032    private String sku;
033
034    private String currency;
035
036    private String country;
037
038    private com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup;
039
040    private com.commercetools.api.models.channel.ChannelResourceIdentifier channel;
041
042    private java.time.ZonedDateTime validFrom;
043
044    private java.time.ZonedDateTime validUntil;
045
046    private java.time.ZonedDateTime conflictingValidFrom;
047
048    private java.time.ZonedDateTime conflictingValidUntil;
049
050    /**
051     * create instance with all properties
052     */
053    @JsonCreator
054    OverlappingStandalonePriceValidityErrorImpl(@JsonProperty("message") final String message,
055            @JsonProperty("values") final Map<String, java.lang.Object> values,
056            @JsonProperty("conflictingStandalonePrice") final com.commercetools.api.models.standalone_price.StandalonePriceReference conflictingStandalonePrice,
057            @JsonProperty("sku") final String sku, @JsonProperty("currency") final String currency,
058            @JsonProperty("country") final String country,
059            @JsonProperty("customerGroup") final com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup,
060            @JsonProperty("channel") final com.commercetools.api.models.channel.ChannelResourceIdentifier channel,
061            @JsonProperty("validFrom") final java.time.ZonedDateTime validFrom,
062            @JsonProperty("validUntil") final java.time.ZonedDateTime validUntil,
063            @JsonProperty("conflictingValidFrom") final java.time.ZonedDateTime conflictingValidFrom,
064            @JsonProperty("conflictingValidUntil") final java.time.ZonedDateTime conflictingValidUntil) {
065        this.message = message;
066        this.values = values;
067        this.conflictingStandalonePrice = conflictingStandalonePrice;
068        this.sku = sku;
069        this.currency = currency;
070        this.country = country;
071        this.customerGroup = customerGroup;
072        this.channel = channel;
073        this.validFrom = validFrom;
074        this.validUntil = validUntil;
075        this.conflictingValidFrom = conflictingValidFrom;
076        this.conflictingValidUntil = conflictingValidUntil;
077        this.code = OVERLAPPING_STANDALONE_PRICE_VALIDITY;
078    }
079
080    /**
081     * create empty instance
082     */
083    public OverlappingStandalonePriceValidityErrorImpl() {
084        this.code = OVERLAPPING_STANDALONE_PRICE_VALIDITY;
085    }
086
087    /**
088     *
089     */
090
091    public String getCode() {
092        return this.code;
093    }
094
095    /**
096     *  <p><code>Two standalone prices have overlapping validity periods."</code></p>
097     */
098
099    public String getMessage() {
100        return this.message;
101    }
102
103    /**
104     *  <p>Error-specific additional fields.</p>
105     */
106
107    public Map<String, java.lang.Object> values() {
108        return values;
109    }
110
111    /**
112     *  <p>Reference to the conflicting Standalone Price.</p>
113     */
114
115    public com.commercetools.api.models.standalone_price.StandalonePriceReference getConflictingStandalonePrice() {
116        return this.conflictingStandalonePrice;
117    }
118
119    /**
120     *  <p>SKU of the ProductVariant to which the conflicting Standalone Price is associated.</p>
121     */
122
123    public String getSku() {
124        return this.sku;
125    }
126
127    /**
128     *  <p>Currency code of the country.</p>
129     */
130
131    public String getCurrency() {
132        return this.currency;
133    }
134
135    /**
136     *  <p>Country code of the geographic location.</p>
137     */
138
139    public String getCountry() {
140        return this.country;
141    }
142
143    /**
144     *  <p>CustomerGroup for which the Standalone Price is valid.</p>
145     */
146
147    public com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier getCustomerGroup() {
148        return this.customerGroup;
149    }
150
151    /**
152     *  <p>Channel for which the Standalone Price is valid.</p>
153     */
154
155    public com.commercetools.api.models.channel.ChannelResourceIdentifier getChannel() {
156        return this.channel;
157    }
158
159    /**
160     *  <p>Date and time (UTC) from which the Standalone Price is valid.</p>
161     */
162
163    public java.time.ZonedDateTime getValidFrom() {
164        return this.validFrom;
165    }
166
167    /**
168     *  <p>Date and time (UTC) until which the Standalone Price is valid.</p>
169     */
170
171    public java.time.ZonedDateTime getValidUntil() {
172        return this.validUntil;
173    }
174
175    /**
176     *  <p>Date and time (UTC) from which the conflicting Standalone Price is valid.</p>
177     */
178
179    public java.time.ZonedDateTime getConflictingValidFrom() {
180        return this.conflictingValidFrom;
181    }
182
183    /**
184     *  <p>Date and time (UTC) until which the conflicting Standalone Price is valid.</p>
185     */
186
187    public java.time.ZonedDateTime getConflictingValidUntil() {
188        return this.conflictingValidUntil;
189    }
190
191    public void setMessage(final String message) {
192        this.message = message;
193    }
194
195    public void setValue(String key, java.lang.Object value) {
196        if (values == null) {
197            values = new HashMap<>();
198        }
199        values.put(key, value);
200    }
201
202    public void setConflictingStandalonePrice(
203            final com.commercetools.api.models.standalone_price.StandalonePriceReference conflictingStandalonePrice) {
204        this.conflictingStandalonePrice = conflictingStandalonePrice;
205    }
206
207    public void setSku(final String sku) {
208        this.sku = sku;
209    }
210
211    public void setCurrency(final String currency) {
212        this.currency = currency;
213    }
214
215    public void setCountry(final String country) {
216        this.country = country;
217    }
218
219    public void setCustomerGroup(
220            final com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup) {
221        this.customerGroup = customerGroup;
222    }
223
224    public void setChannel(final com.commercetools.api.models.channel.ChannelResourceIdentifier channel) {
225        this.channel = channel;
226    }
227
228    public void setValidFrom(final java.time.ZonedDateTime validFrom) {
229        this.validFrom = validFrom;
230    }
231
232    public void setValidUntil(final java.time.ZonedDateTime validUntil) {
233        this.validUntil = validUntil;
234    }
235
236    public void setConflictingValidFrom(final java.time.ZonedDateTime conflictingValidFrom) {
237        this.conflictingValidFrom = conflictingValidFrom;
238    }
239
240    public void setConflictingValidUntil(final java.time.ZonedDateTime conflictingValidUntil) {
241        this.conflictingValidUntil = conflictingValidUntil;
242    }
243
244    @Override
245    public boolean equals(Object o) {
246        if (this == o)
247            return true;
248
249        if (o == null || getClass() != o.getClass())
250            return false;
251
252        OverlappingStandalonePriceValidityErrorImpl that = (OverlappingStandalonePriceValidityErrorImpl) o;
253
254        return new EqualsBuilder().append(code, that.code)
255                .append(message, that.message)
256                .append(values, that.values)
257                .append(conflictingStandalonePrice, that.conflictingStandalonePrice)
258                .append(sku, that.sku)
259                .append(currency, that.currency)
260                .append(country, that.country)
261                .append(customerGroup, that.customerGroup)
262                .append(channel, that.channel)
263                .append(validFrom, that.validFrom)
264                .append(validUntil, that.validUntil)
265                .append(conflictingValidFrom, that.conflictingValidFrom)
266                .append(conflictingValidUntil, that.conflictingValidUntil)
267                .append(code, that.code)
268                .append(message, that.message)
269                .append(values, that.values)
270                .append(conflictingStandalonePrice, that.conflictingStandalonePrice)
271                .append(sku, that.sku)
272                .append(currency, that.currency)
273                .append(country, that.country)
274                .append(customerGroup, that.customerGroup)
275                .append(channel, that.channel)
276                .append(validFrom, that.validFrom)
277                .append(validUntil, that.validUntil)
278                .append(conflictingValidFrom, that.conflictingValidFrom)
279                .append(conflictingValidUntil, that.conflictingValidUntil)
280                .isEquals();
281    }
282
283    @Override
284    public int hashCode() {
285        return new HashCodeBuilder(17, 37).append(code)
286                .append(message)
287                .append(values)
288                .append(conflictingStandalonePrice)
289                .append(sku)
290                .append(currency)
291                .append(country)
292                .append(customerGroup)
293                .append(channel)
294                .append(validFrom)
295                .append(validUntil)
296                .append(conflictingValidFrom)
297                .append(conflictingValidUntil)
298                .toHashCode();
299    }
300
301}