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 Discount cannot be created or activated as the limit for active Cart Discounts has been reached.</p> 019 * <p>The error is returned as a failed response to:</p> 020 * <ul> 021 * <li>Create CartDiscount and Create CartDiscount in Store requests</li> 022 * <li>Change IsActive update action</li> 023 * </ul> 024 */ 025@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 026public class GraphQLMaxCartDiscountsReachedErrorImpl implements GraphQLMaxCartDiscountsReachedError, ModelBase { 027 028 private String code; 029 030 private Map<String, java.lang.Object> values; 031 032 /** 033 * create instance with all properties 034 */ 035 @JsonCreator 036 GraphQLMaxCartDiscountsReachedErrorImpl(@JsonProperty("values") final Map<String, java.lang.Object> values) { 037 this.values = values; 038 this.code = MAX_CART_DISCOUNTS_REACHED; 039 } 040 041 /** 042 * create empty instance 043 */ 044 public GraphQLMaxCartDiscountsReachedErrorImpl() { 045 this.code = MAX_CART_DISCOUNTS_REACHED; 046 } 047 048 /** 049 * 050 */ 051 052 public String getCode() { 053 return this.code; 054 } 055 056 /** 057 * <p>Error-specific additional fields.</p> 058 */ 059 060 public Map<String, java.lang.Object> values() { 061 return values; 062 } 063 064 public void setValue(String key, java.lang.Object value) { 065 if (values == null) { 066 values = new HashMap<>(); 067 } 068 values.put(key, value); 069 } 070 071 @Override 072 public boolean equals(Object o) { 073 if (this == o) 074 return true; 075 076 if (o == null || getClass() != o.getClass()) 077 return false; 078 079 GraphQLMaxCartDiscountsReachedErrorImpl that = (GraphQLMaxCartDiscountsReachedErrorImpl) o; 080 081 return new EqualsBuilder().append(code, that.code) 082 .append(values, that.values) 083 .append(code, that.code) 084 .append(values, that.values) 085 .isEquals(); 086 } 087 088 @Override 089 public int hashCode() { 090 return new HashCodeBuilder(17, 37).append(code).append(values).toHashCode(); 091 } 092 093}