001
002package com.commercetools.api.models.tax_category;
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 * TaxRateDraft
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class TaxRateDraftImpl implements TaxRateDraft, ModelBase {
022
023    private String name;
024
025    private Double amount;
026
027    private Boolean includedInPrice;
028
029    private String country;
030
031    private String state;
032
033    private java.util.List<com.commercetools.api.models.tax_category.SubRate> subRates;
034
035    private String key;
036
037    /**
038     * create instance with all properties
039     */
040    @JsonCreator
041    TaxRateDraftImpl(@JsonProperty("name") final String name, @JsonProperty("amount") final Double amount,
042            @JsonProperty("includedInPrice") final Boolean includedInPrice,
043            @JsonProperty("country") final String country, @JsonProperty("state") final String state,
044            @JsonProperty("subRates") final java.util.List<com.commercetools.api.models.tax_category.SubRate> subRates,
045            @JsonProperty("key") final String key) {
046        this.name = name;
047        this.amount = amount;
048        this.includedInPrice = includedInPrice;
049        this.country = country;
050        this.state = state;
051        this.subRates = subRates;
052        this.key = key;
053    }
054
055    /**
056     * create empty instance
057     */
058    public TaxRateDraftImpl() {
059    }
060
061    /**
062     *  <p>Name of the TaxRate.</p>
063     */
064
065    public String getName() {
066        return this.name;
067    }
068
069    /**
070     *  <p>Tax rate. Must be supplied if no <code>subRates</code> are specified. If <code>subRates</code> are specified, this field can be omitted or it must be the sum of amounts of all <code>subRates</code>.</p>
071     */
072
073    public Double getAmount() {
074        return this.amount;
075    }
076
077    /**
078     *  <p>If <code>true</code>, tax is included in Embedded Prices or Standalone Prices, and the <code>taxedPrice</code> is present on LineItems. In this case, the <code>totalNet</code> price on TaxedPrice includes the TaxRate.</p>
079     */
080
081    public Boolean getIncludedInPrice() {
082        return this.includedInPrice;
083    }
084
085    /**
086     *  <p>Country in which the tax rate is applied in ISO 3166-1 alpha-2 format.</p>
087     */
088
089    public String getCountry() {
090        return this.country;
091    }
092
093    /**
094     *  <p>State within the country, such as Texas in the United States.</p>
095     */
096
097    public String getState() {
098        return this.state;
099    }
100
101    /**
102     *  <p>Used to calculate the taxPortions field in a Cart or Order. It is useful if the total tax of a country (such as the US) is a combination of multiple taxes (such as state and local taxes).</p>
103     */
104
105    public java.util.List<com.commercetools.api.models.tax_category.SubRate> getSubRates() {
106        return this.subRates;
107    }
108
109    /**
110     *  <p>User-defined unique identifier of the TaxRate.</p>
111     */
112
113    public String getKey() {
114        return this.key;
115    }
116
117    public void setName(final String name) {
118        this.name = name;
119    }
120
121    public void setAmount(final Double amount) {
122        this.amount = amount;
123    }
124
125    public void setIncludedInPrice(final Boolean includedInPrice) {
126        this.includedInPrice = includedInPrice;
127    }
128
129    public void setCountry(final String country) {
130        this.country = country;
131    }
132
133    public void setState(final String state) {
134        this.state = state;
135    }
136
137    public void setSubRates(final com.commercetools.api.models.tax_category.SubRate... subRates) {
138        this.subRates = new ArrayList<>(Arrays.asList(subRates));
139    }
140
141    public void setSubRates(final java.util.List<com.commercetools.api.models.tax_category.SubRate> subRates) {
142        this.subRates = subRates;
143    }
144
145    public void setKey(final String key) {
146        this.key = key;
147    }
148
149    @Override
150    public boolean equals(Object o) {
151        if (this == o)
152            return true;
153
154        if (o == null || getClass() != o.getClass())
155            return false;
156
157        TaxRateDraftImpl that = (TaxRateDraftImpl) o;
158
159        return new EqualsBuilder().append(name, that.name)
160                .append(amount, that.amount)
161                .append(includedInPrice, that.includedInPrice)
162                .append(country, that.country)
163                .append(state, that.state)
164                .append(subRates, that.subRates)
165                .append(key, that.key)
166                .append(name, that.name)
167                .append(amount, that.amount)
168                .append(includedInPrice, that.includedInPrice)
169                .append(country, that.country)
170                .append(state, that.state)
171                .append(subRates, that.subRates)
172                .append(key, that.key)
173                .isEquals();
174    }
175
176    @Override
177    public int hashCode() {
178        return new HashCodeBuilder(17, 37).append(name)
179                .append(amount)
180                .append(includedInPrice)
181                .append(country)
182                .append(state)
183                .append(subRates)
184                .append(key)
185                .toHashCode();
186    }
187
188}