001/* Copyright (C) 2014 konik.io
002 *
003 * This file is part of the Konik library.
004 *
005 * The Konik library is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * The Konik library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with the Konik library. If not, see <http://www.gnu.org/licenses/>.
017 */
018package io.konik.zugferd.entity.trade;
019
020import io.konik.validator.annotation.Basic;
021import io.konik.validator.annotation.Comfort;
022import io.konik.validator.annotation.Extended;
023import io.konik.zugferd.entity.trade.item.SpecifiedTax;
024import io.konik.zugferd.unece.codes.TaxCategory;
025import io.konik.zugferd.unece.codes.TaxCode;
026import io.konik.zugferd.unqualified.Amount;
027
028import java.math.BigDecimal;
029
030import javax.validation.Valid;
031import javax.validation.constraints.NotNull;
032
033/**
034 * = The tax applied to a trade.
035 */
036public class TradeTax extends SpecifiedTax {
037
038   @Basic
039   @NotNull
040   @Valid
041   @Override
042   public Amount getCalculated() {
043      return calculated;
044   }
045
046   @Override
047   public TradeTax setCalculated(Amount calculatedAmount) {
048      return (TradeTax) super.setCalculated(calculatedAmount);
049   }
050
051   @Basic
052   @NotNull
053   @Override
054   public TaxCode getType() {
055      return type;
056   }
057
058   @Override
059   public TradeTax setType(TaxCode taxTypeCode) {
060      this.type = taxTypeCode;
061      return this;
062   }
063
064   /**
065    * Gets the basis amount for tax calculation.
066    * 
067    * @return the basis amount
068    */
069   @Basic
070   @Valid
071   @NotNull
072   public Amount getBasis() {
073      return basis;
074   }
075
076   /**
077    * Sets the basis amount for tax calculation.
078    * 
079    * @param basisAmount the new basis amount
080    * @return the tax
081    */
082   public TradeTax setBasis(Amount basisAmount) {
083      this.basis = basisAmount;
084      return this;
085   }
086
087   /**
088    * Gets the line total.
089    *
090    * @return the line total
091    */
092   @Valid
093   @Extended
094   public Amount getLineTotal() {
095      return lineTotal;
096   }
097
098   /**
099    * Sets the line total.
100    *
101    * @param lineTotal the new line total
102    */
103   public void setLineTotal(Amount lineTotal) {
104      this.lineTotal = lineTotal;
105   }
106
107   /**
108    * Gets the allowance charge.
109    *
110    * @return the allowance charge
111    */
112   @Valid
113   @Extended
114   public Amount getAllowanceCharge() {
115      return allowanceCharge;
116   }
117
118   /**
119    * Sets the allowance charge.
120    *
121    * @param allowanceCharge the new allowance charge
122    */
123   public void setAllowanceCharge(Amount allowanceCharge) {
124      this.allowanceCharge = allowanceCharge;
125   }
126
127   @Comfort
128   @Override
129   public TaxCategory getCategory() {
130      return super.getCategory();
131   }
132
133   @Override
134   public TradeTax setCategory(TaxCategory value) {
135      return (TradeTax) super.setCategory(value);
136   }
137
138   
139   @Basic
140   @NotNull
141   @Override
142   public BigDecimal getPercentage() {
143      return super.getPercentage();
144   }
145
146   @Override
147   public TradeTax setPercentage(BigDecimal applicablePercentage) {
148      return (TradeTax) super.setPercentage(applicablePercentage);
149   }
150
151   @Override
152   public TradeTax setExemptionReason(String exemptionReason) {
153      super.setExemptionReason(exemptionReason);
154      return this;
155   }
156}