001
002package com.commercetools.api.models.product_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 * ProductDiscountDraft
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class ProductDiscountDraftImpl implements ProductDiscountDraft, ModelBase {
022
023    private com.commercetools.api.models.common.LocalizedString name;
024
025    private String key;
026
027    private com.commercetools.api.models.common.LocalizedString description;
028
029    private com.commercetools.api.models.product_discount.ProductDiscountValueDraft value;
030
031    private String predicate;
032
033    private String sortOrder;
034
035    private Boolean isActive;
036
037    private java.time.ZonedDateTime validFrom;
038
039    private java.time.ZonedDateTime validUntil;
040
041    /**
042     * create instance with all properties
043     */
044    @JsonCreator
045    ProductDiscountDraftImpl(@JsonProperty("name") final com.commercetools.api.models.common.LocalizedString name,
046            @JsonProperty("key") final String key,
047            @JsonProperty("description") final com.commercetools.api.models.common.LocalizedString description,
048            @JsonProperty("value") final com.commercetools.api.models.product_discount.ProductDiscountValueDraft value,
049            @JsonProperty("predicate") final String predicate, @JsonProperty("sortOrder") final String sortOrder,
050            @JsonProperty("isActive") final Boolean isActive,
051            @JsonProperty("validFrom") final java.time.ZonedDateTime validFrom,
052            @JsonProperty("validUntil") final java.time.ZonedDateTime validUntil) {
053        this.name = name;
054        this.key = key;
055        this.description = description;
056        this.value = value;
057        this.predicate = predicate;
058        this.sortOrder = sortOrder;
059        this.isActive = isActive;
060        this.validFrom = validFrom;
061        this.validUntil = validUntil;
062    }
063
064    /**
065     * create empty instance
066     */
067    public ProductDiscountDraftImpl() {
068    }
069
070    /**
071     *  <p>Name of the ProductDiscount.</p>
072     */
073
074    public com.commercetools.api.models.common.LocalizedString getName() {
075        return this.name;
076    }
077
078    /**
079     *  <p>User-defined unique identifier for the ProductDiscount.</p>
080     */
081
082    public String getKey() {
083        return this.key;
084    }
085
086    /**
087     *  <p>Description of the ProductDiscount.</p>
088     */
089
090    public com.commercetools.api.models.common.LocalizedString getDescription() {
091        return this.description;
092    }
093
094    /**
095     *  <p>Type of Discount and its corresponding value.</p>
096     */
097
098    public com.commercetools.api.models.product_discount.ProductDiscountValueDraft getValue() {
099        return this.value;
100    }
101
102    /**
103     *  <p>Valid ProductDiscount predicate.</p>
104     */
105
106    public String getPredicate() {
107        return this.predicate;
108    }
109
110    /**
111     *  <p>Decimal value between 0 and 1 (passed as String literal) that defines the order of ProductDiscounts to apply in case more than one is applicable and active. A ProductDiscount with a higher <code>sortOrder</code> is prioritized. The value must be <strong>unique</strong> among all ProductDiscounts in the Project.</p>
112     */
113
114    public String getSortOrder() {
115        return this.sortOrder;
116    }
117
118    /**
119     *  <p>Set to <code>true</code> to activate the ProductDiscount, set to <code>false</code> to deactivate it (even though the <code>predicate</code> matches).</p>
120     */
121
122    public Boolean getIsActive() {
123        return this.isActive;
124    }
125
126    /**
127     *  <p>Date and time (UTC) from which the Discount is effective. Take Eventual Consistency into account for calculated discount values.</p>
128     */
129
130    public java.time.ZonedDateTime getValidFrom() {
131        return this.validFrom;
132    }
133
134    /**
135     *  <p>Date and time (UTC) until which the Discount is effective. Take Eventual Consistency into account for calculated undiscounted values.</p>
136     */
137
138    public java.time.ZonedDateTime getValidUntil() {
139        return this.validUntil;
140    }
141
142    public void setName(final com.commercetools.api.models.common.LocalizedString name) {
143        this.name = name;
144    }
145
146    public void setKey(final String key) {
147        this.key = key;
148    }
149
150    public void setDescription(final com.commercetools.api.models.common.LocalizedString description) {
151        this.description = description;
152    }
153
154    public void setValue(final com.commercetools.api.models.product_discount.ProductDiscountValueDraft value) {
155        this.value = value;
156    }
157
158    public void setPredicate(final String predicate) {
159        this.predicate = predicate;
160    }
161
162    public void setSortOrder(final String sortOrder) {
163        this.sortOrder = sortOrder;
164    }
165
166    public void setIsActive(final Boolean isActive) {
167        this.isActive = isActive;
168    }
169
170    public void setValidFrom(final java.time.ZonedDateTime validFrom) {
171        this.validFrom = validFrom;
172    }
173
174    public void setValidUntil(final java.time.ZonedDateTime validUntil) {
175        this.validUntil = validUntil;
176    }
177
178    @Override
179    public boolean equals(Object o) {
180        if (this == o)
181            return true;
182
183        if (o == null || getClass() != o.getClass())
184            return false;
185
186        ProductDiscountDraftImpl that = (ProductDiscountDraftImpl) o;
187
188        return new EqualsBuilder().append(name, that.name)
189                .append(key, that.key)
190                .append(description, that.description)
191                .append(value, that.value)
192                .append(predicate, that.predicate)
193                .append(sortOrder, that.sortOrder)
194                .append(isActive, that.isActive)
195                .append(validFrom, that.validFrom)
196                .append(validUntil, that.validUntil)
197                .isEquals();
198    }
199
200    @Override
201    public int hashCode() {
202        return new HashCodeBuilder(17, 37).append(name)
203                .append(key)
204                .append(description)
205                .append(value)
206                .append(predicate)
207                .append(sortOrder)
208                .append(isActive)
209                .append(validFrom)
210                .append(validUntil)
211                .toHashCode();
212    }
213
214}