001
002package com.commercetools.api.models.message;
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>Generated after the DiscountCodeState changes due to a recalculation.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class OrderDiscountCodeStateSetMessagePayloadImpl implements OrderDiscountCodeStateSetMessagePayload, ModelBase {
022
023    private String type;
024
025    private com.commercetools.api.models.discount_code.DiscountCodeReference discountCode;
026
027    private com.commercetools.api.models.cart.DiscountCodeState state;
028
029    private com.commercetools.api.models.cart.DiscountCodeState oldState;
030
031    /**
032     * create instance with all properties
033     */
034    @JsonCreator
035    OrderDiscountCodeStateSetMessagePayloadImpl(
036            @JsonProperty("discountCode") final com.commercetools.api.models.discount_code.DiscountCodeReference discountCode,
037            @JsonProperty("state") final com.commercetools.api.models.cart.DiscountCodeState state,
038            @JsonProperty("oldState") final com.commercetools.api.models.cart.DiscountCodeState oldState) {
039        this.discountCode = discountCode;
040        this.state = state;
041        this.oldState = oldState;
042        this.type = ORDER_DISCOUNT_CODE_STATE_SET;
043    }
044
045    /**
046     * create empty instance
047     */
048    public OrderDiscountCodeStateSetMessagePayloadImpl() {
049        this.type = ORDER_DISCOUNT_CODE_STATE_SET;
050    }
051
052    /**
053     *
054     */
055
056    public String getType() {
057        return this.type;
058    }
059
060    /**
061     *  <p>DiscountCode that changed due to the recalculation.</p>
062     */
063
064    public com.commercetools.api.models.discount_code.DiscountCodeReference getDiscountCode() {
065        return this.discountCode;
066    }
067
068    /**
069     *  <p>DiscountCodeState after the recalculation.</p>
070     */
071
072    public com.commercetools.api.models.cart.DiscountCodeState getState() {
073        return this.state;
074    }
075
076    /**
077     *  <p>DiscountCodeState before the recalculation.</p>
078     */
079
080    public com.commercetools.api.models.cart.DiscountCodeState getOldState() {
081        return this.oldState;
082    }
083
084    public void setDiscountCode(final com.commercetools.api.models.discount_code.DiscountCodeReference discountCode) {
085        this.discountCode = discountCode;
086    }
087
088    public void setState(final com.commercetools.api.models.cart.DiscountCodeState state) {
089        this.state = state;
090    }
091
092    public void setOldState(final com.commercetools.api.models.cart.DiscountCodeState oldState) {
093        this.oldState = oldState;
094    }
095
096    @Override
097    public boolean equals(Object o) {
098        if (this == o)
099            return true;
100
101        if (o == null || getClass() != o.getClass())
102            return false;
103
104        OrderDiscountCodeStateSetMessagePayloadImpl that = (OrderDiscountCodeStateSetMessagePayloadImpl) o;
105
106        return new EqualsBuilder().append(type, that.type)
107                .append(discountCode, that.discountCode)
108                .append(state, that.state)
109                .append(oldState, that.oldState)
110                .isEquals();
111    }
112
113    @Override
114    public int hashCode() {
115        return new HashCodeBuilder(17, 37).append(type)
116                .append(discountCode)
117                .append(state)
118                .append(oldState)
119                .toHashCode();
120    }
121
122}