001
002package com.commercetools.history.models.common;
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>Shape of the value for <code>addTaxRate</code> and <code>removeTaxRate</code> actions</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class TaxRateImpl implements TaxRate, ModelBase {
022
023    private String id;
024
025    private String name;
026
027    private Integer amount;
028
029    private Boolean includedInPrice;
030
031    private String country;
032
033    private String state;
034
035    private java.util.List<com.commercetools.history.models.common.SubRate> subRates;
036
037    /**
038     * create instance with all properties
039     */
040    @JsonCreator
041    TaxRateImpl(@JsonProperty("id") final String id, @JsonProperty("name") final String name,
042            @JsonProperty("amount") final Integer amount,
043            @JsonProperty("includedInPrice") final Boolean includedInPrice,
044            @JsonProperty("country") final String country, @JsonProperty("state") final String state,
045            @JsonProperty("subRates") final java.util.List<com.commercetools.history.models.common.SubRate> subRates) {
046        this.id = id;
047        this.name = name;
048        this.amount = amount;
049        this.includedInPrice = includedInPrice;
050        this.country = country;
051        this.state = state;
052        this.subRates = subRates;
053    }
054
055    /**
056     * create empty instance
057     */
058    public TaxRateImpl() {
059    }
060
061    /**
062     *  <p>The ID is always set if the tax rate is part of a TaxCategory. The external tax rates in a Cart do not contain an <code>id</code>.</p>
063     */
064
065    public String getId() {
066        return this.id;
067    }
068
069    /**
070     *
071     */
072
073    public String getName() {
074        return this.name;
075    }
076
077    /**
078     *  <p>Percentage in the range of [0..1]. The sum of the amounts of all <code>subRates</code>, if there are any.</p>
079     */
080
081    public Integer getAmount() {
082        return this.amount;
083    }
084
085    /**
086     *
087     */
088
089    public Boolean getIncludedInPrice() {
090        return this.includedInPrice;
091    }
092
093    /**
094     *  <p>Two-digit country code as per ISO 3166-1 alpha-2.</p>
095     */
096
097    public String getCountry() {
098        return this.country;
099    }
100
101    /**
102     *  <p>The state in the country</p>
103     */
104
105    public String getState() {
106        return this.state;
107    }
108
109    /**
110     *
111     */
112
113    public java.util.List<com.commercetools.history.models.common.SubRate> getSubRates() {
114        return this.subRates;
115    }
116
117    public void setId(final String id) {
118        this.id = id;
119    }
120
121    public void setName(final String name) {
122        this.name = name;
123    }
124
125    public void setAmount(final Integer amount) {
126        this.amount = amount;
127    }
128
129    public void setIncludedInPrice(final Boolean includedInPrice) {
130        this.includedInPrice = includedInPrice;
131    }
132
133    public void setCountry(final String country) {
134        this.country = country;
135    }
136
137    public void setState(final String state) {
138        this.state = state;
139    }
140
141    public void setSubRates(final com.commercetools.history.models.common.SubRate... subRates) {
142        this.subRates = new ArrayList<>(Arrays.asList(subRates));
143    }
144
145    public void setSubRates(final java.util.List<com.commercetools.history.models.common.SubRate> subRates) {
146        this.subRates = subRates;
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        TaxRateImpl that = (TaxRateImpl) o;
158
159        return new EqualsBuilder().append(id, that.id)
160                .append(name, that.name)
161                .append(amount, that.amount)
162                .append(includedInPrice, that.includedInPrice)
163                .append(country, that.country)
164                .append(state, that.state)
165                .append(subRates, that.subRates)
166                .append(id, that.id)
167                .append(name, that.name)
168                .append(amount, that.amount)
169                .append(includedInPrice, that.includedInPrice)
170                .append(country, that.country)
171                .append(state, that.state)
172                .append(subRates, that.subRates)
173                .isEquals();
174    }
175
176    @Override
177    public int hashCode() {
178        return new HashCodeBuilder(17, 37).append(id)
179                .append(name)
180                .append(amount)
181                .append(includedInPrice)
182                .append(country)
183                .append(state)
184                .append(subRates)
185                .toHashCode();
186    }
187
188}