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 resource type cannot be created as it has reached its limits.</p>
019 *  <p>The limits must be adjusted for this resource before sending the request again.</p>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class MaxResourceLimitExceededErrorImpl implements MaxResourceLimitExceededError, 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.common.ReferenceTypeId exceededResource;
031
032    /**
033     * create instance with all properties
034     */
035    @JsonCreator
036    MaxResourceLimitExceededErrorImpl(@JsonProperty("message") final String message,
037            @JsonProperty("values") final Map<String, java.lang.Object> values,
038            @JsonProperty("exceededResource") final com.commercetools.api.models.common.ReferenceTypeId exceededResource) {
039        this.message = message;
040        this.values = values;
041        this.exceededResource = exceededResource;
042        this.code = MAX_RESOURCE_LIMIT_EXCEEDED;
043    }
044
045    /**
046     * create empty instance
047     */
048    public MaxResourceLimitExceededErrorImpl() {
049        this.code = MAX_RESOURCE_LIMIT_EXCEEDED;
050    }
051
052    /**
053     *
054     */
055
056    public String getCode() {
057        return this.code;
058    }
059
060    /**
061     *  <p><code>"You have exceeded the limit of $limit resources of type $resourceTypeId."</code></p>
062     */
063
064    public String getMessage() {
065        return this.message;
066    }
067
068    /**
069     *  <p>Error-specific additional fields.</p>
070     */
071
072    public Map<String, java.lang.Object> values() {
073        return values;
074    }
075
076    /**
077     *  <p>Resource type that reached its maximum limit of configured elements (for example, 100 Zones per Project).</p>
078     */
079
080    public com.commercetools.api.models.common.ReferenceTypeId getExceededResource() {
081        return this.exceededResource;
082    }
083
084    public void setMessage(final String message) {
085        this.message = message;
086    }
087
088    public void setValue(String key, java.lang.Object value) {
089        if (values == null) {
090            values = new HashMap<>();
091        }
092        values.put(key, value);
093    }
094
095    public void setExceededResource(final com.commercetools.api.models.common.ReferenceTypeId exceededResource) {
096        this.exceededResource = exceededResource;
097    }
098
099    @Override
100    public boolean equals(Object o) {
101        if (this == o)
102            return true;
103
104        if (o == null || getClass() != o.getClass())
105            return false;
106
107        MaxResourceLimitExceededErrorImpl that = (MaxResourceLimitExceededErrorImpl) o;
108
109        return new EqualsBuilder().append(code, that.code)
110                .append(message, that.message)
111                .append(values, that.values)
112                .append(exceededResource, that.exceededResource)
113                .isEquals();
114    }
115
116    @Override
117    public int hashCode() {
118        return new HashCodeBuilder(17, 37).append(code)
119                .append(message)
120                .append(values)
121                .append(exceededResource)
122                .toHashCode();
123    }
124
125}