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 language cannot be removed from a Project as it is being used by a Store.</p>
019 *  <p>The error is returned as a failed response to the Change Languages update action.</p>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class LanguageUsedInStoresErrorImpl implements LanguageUsedInStoresError, ModelBase {
023
024    private String code;
025
026    private String message;
027
028    private Map<String, java.lang.Object> values;
029
030    /**
031     * create instance with all properties
032     */
033    @JsonCreator
034    LanguageUsedInStoresErrorImpl(@JsonProperty("message") final String message,
035            @JsonProperty("values") final Map<String, java.lang.Object> values) {
036        this.message = message;
037        this.values = values;
038        this.code = LANGUAGE_USED_IN_STORES;
039    }
040
041    /**
042     * create empty instance
043     */
044    public LanguageUsedInStoresErrorImpl() {
045        this.code = LANGUAGE_USED_IN_STORES;
046    }
047
048    /**
049     *
050     */
051
052    public String getCode() {
053        return this.code;
054    }
055
056    /**
057     *  <p><code>"Language(s) in use by a store cannot be deleted. Remove them in all the stores of this project first."</code></p>
058     */
059
060    public String getMessage() {
061        return this.message;
062    }
063
064    /**
065     *  <p>Error-specific additional fields.</p>
066     */
067
068    public Map<String, java.lang.Object> values() {
069        return values;
070    }
071
072    public void setMessage(final String message) {
073        this.message = message;
074    }
075
076    public void setValue(String key, java.lang.Object value) {
077        if (values == null) {
078            values = new HashMap<>();
079        }
080        values.put(key, value);
081    }
082
083    @Override
084    public boolean equals(Object o) {
085        if (this == o)
086            return true;
087
088        if (o == null || getClass() != o.getClass())
089            return false;
090
091        LanguageUsedInStoresErrorImpl that = (LanguageUsedInStoresErrorImpl) o;
092
093        return new EqualsBuilder().append(code, that.code)
094                .append(message, that.message)
095                .append(values, that.values)
096                .isEquals();
097    }
098
099    @Override
100    public int hashCode() {
101        return new HashCodeBuilder(17, 37).append(code).append(message).append(values).toHashCode();
102    }
103
104}