001
002package com.commercetools.api.models.cart_discount;
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>Sets the DiscountedLineItemPrice of the CartDiscountLineItemsTarget or CartDiscountCustomLineItemsTarget to the value specified in the <code>money</code> field, if it is lower than the current Line Item price for the same currency. If the Line Item price is already discounted to a price equal to or lower than the respective price in the <code>money</code> field, this Discount is not applied. If the <code>quantity</code> of the Line Item eligible for the Discount is greater than <code>1</code>, the fixed price discount is only applied to the Line Item portion for which the <code>money</code> value is lesser than their current price.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class CartDiscountValueFixedImpl implements CartDiscountValueFixed, ModelBase {
022
023    private String type;
024
025    private java.util.List<com.commercetools.api.models.common.TypedMoney> money;
026
027    /**
028     * create instance with all properties
029     */
030    @JsonCreator
031    CartDiscountValueFixedImpl(
032            @JsonProperty("money") final java.util.List<com.commercetools.api.models.common.TypedMoney> money) {
033        this.money = money;
034        this.type = FIXED;
035    }
036
037    /**
038     * create empty instance
039     */
040    public CartDiscountValueFixedImpl() {
041        this.type = FIXED;
042    }
043
044    /**
045     *
046     */
047
048    public String getType() {
049        return this.type;
050    }
051
052    /**
053     *  <p>Money values in cent precision or high precision of different currencies.</p>
054     */
055
056    public java.util.List<com.commercetools.api.models.common.TypedMoney> getMoney() {
057        return this.money;
058    }
059
060    public void setMoney(final com.commercetools.api.models.common.TypedMoney... money) {
061        this.money = new ArrayList<>(Arrays.asList(money));
062    }
063
064    public void setMoney(final java.util.List<com.commercetools.api.models.common.TypedMoney> money) {
065        this.money = money;
066    }
067
068    @Override
069    public boolean equals(Object o) {
070        if (this == o)
071            return true;
072
073        if (o == null || getClass() != o.getClass())
074            return false;
075
076        CartDiscountValueFixedImpl that = (CartDiscountValueFixedImpl) o;
077
078        return new EqualsBuilder().append(type, that.type)
079                .append(money, that.money)
080                .append(type, that.type)
081                .append(money, that.money)
082                .isEquals();
083    }
084
085    @Override
086    public int hashCode() {
087        return new HashCodeBuilder(17, 37).append(type).append(money).toHashCode();
088    }
089
090}