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 * MultiBuyLineItemsTarget
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class MultiBuyLineItemsTargetImpl implements MultiBuyLineItemsTarget, ModelBase {
022
023    private String type;
024
025    private String predicate;
026
027    private Integer triggerQuantity;
028
029    private Integer discountedQuantity;
030
031    private Integer maxOccurrence;
032
033    private com.commercetools.api.models.cart_discount.SelectionMode selectionMode;
034
035    /**
036     * create instance with all properties
037     */
038    @JsonCreator
039    MultiBuyLineItemsTargetImpl(@JsonProperty("predicate") final String predicate,
040            @JsonProperty("triggerQuantity") final Integer triggerQuantity,
041            @JsonProperty("discountedQuantity") final Integer discountedQuantity,
042            @JsonProperty("maxOccurrence") final Integer maxOccurrence,
043            @JsonProperty("selectionMode") final com.commercetools.api.models.cart_discount.SelectionMode selectionMode) {
044        this.predicate = predicate;
045        this.triggerQuantity = triggerQuantity;
046        this.discountedQuantity = discountedQuantity;
047        this.maxOccurrence = maxOccurrence;
048        this.selectionMode = selectionMode;
049        this.type = MULTI_BUY_LINE_ITEMS;
050    }
051
052    /**
053     * create empty instance
054     */
055    public MultiBuyLineItemsTargetImpl() {
056        this.type = MULTI_BUY_LINE_ITEMS;
057    }
058
059    /**
060     *
061     */
062
063    public String getType() {
064        return this.type;
065    }
066
067    /**
068     *  <p>Valid LineItem target predicate. The Discount will be applied to Line Items that are matched by the predicate.</p>
069     */
070
071    public String getPredicate() {
072        return this.predicate;
073    }
074
075    /**
076     *  <p>Number of Line Items to be present in order to trigger an application of this Discount.</p>
077     */
078
079    public Integer getTriggerQuantity() {
080        return this.triggerQuantity;
081    }
082
083    /**
084     *  <p>Number of Line Items that are discounted per application of this Discount. It must be less than or equal to the <code>triggerQuantity</code>.</p>
085     */
086
087    public Integer getDiscountedQuantity() {
088        return this.discountedQuantity;
089    }
090
091    /**
092     *  <p>Maximum number of times this Discount can be applied. Do not set if the Discount should be applied an unlimited number of times.</p>
093     */
094
095    public Integer getMaxOccurrence() {
096        return this.maxOccurrence;
097    }
098
099    /**
100     *  <p>Discounts particular Line Items only according to the SelectionMode.</p>
101     */
102
103    public com.commercetools.api.models.cart_discount.SelectionMode getSelectionMode() {
104        return this.selectionMode;
105    }
106
107    public void setPredicate(final String predicate) {
108        this.predicate = predicate;
109    }
110
111    public void setTriggerQuantity(final Integer triggerQuantity) {
112        this.triggerQuantity = triggerQuantity;
113    }
114
115    public void setDiscountedQuantity(final Integer discountedQuantity) {
116        this.discountedQuantity = discountedQuantity;
117    }
118
119    public void setMaxOccurrence(final Integer maxOccurrence) {
120        this.maxOccurrence = maxOccurrence;
121    }
122
123    public void setSelectionMode(final com.commercetools.api.models.cart_discount.SelectionMode selectionMode) {
124        this.selectionMode = selectionMode;
125    }
126
127    @Override
128    public boolean equals(Object o) {
129        if (this == o)
130            return true;
131
132        if (o == null || getClass() != o.getClass())
133            return false;
134
135        MultiBuyLineItemsTargetImpl that = (MultiBuyLineItemsTargetImpl) o;
136
137        return new EqualsBuilder().append(type, that.type)
138                .append(predicate, that.predicate)
139                .append(triggerQuantity, that.triggerQuantity)
140                .append(discountedQuantity, that.discountedQuantity)
141                .append(maxOccurrence, that.maxOccurrence)
142                .append(selectionMode, that.selectionMode)
143                .append(type, that.type)
144                .append(predicate, that.predicate)
145                .append(triggerQuantity, that.triggerQuantity)
146                .append(discountedQuantity, that.discountedQuantity)
147                .append(maxOccurrence, that.maxOccurrence)
148                .append(selectionMode, that.selectionMode)
149                .isEquals();
150    }
151
152    @Override
153    public int hashCode() {
154        return new HashCodeBuilder(17, 37).append(type)
155                .append(predicate)
156                .append(triggerQuantity)
157                .append(discountedQuantity)
158                .append(maxOccurrence)
159                .append(selectionMode)
160                .toHashCode();
161    }
162
163}