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 Line Item or Custom Line Item quantities set under ItemShippingDetails do not match the sum of the quantities in their respective shipping details.</p>
019 *  <p>The error is returned as a failed response to the Create Order from Cart and Create Order in Store from Cart requests.</p>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class InvalidItemShippingDetailsErrorImpl implements InvalidItemShippingDetailsError, ModelBase {
023
024    private String code;
025
026    private String message;
027
028    private Map<String, java.lang.Object> values;
029
030    private String subject;
031
032    private String itemId;
033
034    /**
035     * create instance with all properties
036     */
037    @JsonCreator
038    InvalidItemShippingDetailsErrorImpl(@JsonProperty("message") final String message,
039            @JsonProperty("values") final Map<String, java.lang.Object> values,
040            @JsonProperty("subject") final String subject, @JsonProperty("itemId") final String itemId) {
041        this.message = message;
042        this.values = values;
043        this.subject = subject;
044        this.itemId = itemId;
045        this.code = INVALID_ITEM_SHIPPING_DETAILS;
046    }
047
048    /**
049     * create empty instance
050     */
051    public InvalidItemShippingDetailsErrorImpl() {
052        this.code = INVALID_ITEM_SHIPPING_DETAILS;
053    }
054
055    /**
056     *
057     */
058
059    public String getCode() {
060        return this.code;
061    }
062
063    /**
064     *  <p><code>"Inconsistent shipping details for $subject with ID $itemId. $subject quantity is $itemQuantity and shippingTargets quantity sum is $quantitySum."</code></p>
065     */
066
067    public String getMessage() {
068        return this.message;
069    }
070
071    /**
072     *  <p>Error-specific additional fields.</p>
073     */
074
075    public Map<String, java.lang.Object> values() {
076        return values;
077    }
078
079    /**
080     *  <p><code>"LineItem"</code> or <code>"CustomLineItem"</code></p>
081     */
082
083    public String getSubject() {
084        return this.subject;
085    }
086
087    /**
088     *  <p>Unique identifier of the Line Item or Custom Line Item.</p>
089     */
090
091    public String getItemId() {
092        return this.itemId;
093    }
094
095    public void setMessage(final String message) {
096        this.message = message;
097    }
098
099    public void setValue(String key, java.lang.Object value) {
100        if (values == null) {
101            values = new HashMap<>();
102        }
103        values.put(key, value);
104    }
105
106    public void setSubject(final String subject) {
107        this.subject = subject;
108    }
109
110    public void setItemId(final String itemId) {
111        this.itemId = itemId;
112    }
113
114    @Override
115    public boolean equals(Object o) {
116        if (this == o)
117            return true;
118
119        if (o == null || getClass() != o.getClass())
120            return false;
121
122        InvalidItemShippingDetailsErrorImpl that = (InvalidItemShippingDetailsErrorImpl) o;
123
124        return new EqualsBuilder().append(code, that.code)
125                .append(message, that.message)
126                .append(values, that.values)
127                .append(subject, that.subject)
128                .append(itemId, that.itemId)
129                .append(code, that.code)
130                .append(message, that.message)
131                .append(values, that.values)
132                .append(subject, that.subject)
133                .append(itemId, that.itemId)
134                .isEquals();
135    }
136
137    @Override
138    public int hashCode() {
139        return new HashCodeBuilder(17, 37).append(code)
140                .append(message)
141                .append(values)
142                .append(subject)
143                .append(itemId)
144                .toHashCode();
145    }
146
147}