package ee.ut.math.tvt2008.salessystem.penalty;

import java.math.BigDecimal;

import ee.ut.math.tvt2008.salessystem.domain.data.Sale;

/**
 * Class encapsulating result of penalty calculation. It contains:
 *  * amount of penalty
 *  * amount of payback 
 *  * penalty description
 *  * sale for which discount was calclulated
 * 
 * @author Hannes Lehemets
 * 
 */
public class Penalty {

	private BigDecimal penaltyAmount;
	private String description;
	private Sale sale;

	/**
	 * @return Returns the description.
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 *            The description to set.
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return Returns the penaltyAmount.
	 */
	public BigDecimal getPenaltyAmount() {
		return penaltyAmount;
	}

	/**
	 * @param penaltyAmount
	 *            The penaltyAmount to set.
	 */
	public void setPenaltyAmount(BigDecimal penaltyAmount) {
		this.penaltyAmount = penaltyAmount;
	}
	
	/**
	 * @return Returns the paybackAmount.
	 */
	public BigDecimal getPaybackAmount() {
		return penaltyAmount.add(sale.getSum());
	}
	
	/**
	 * @return Returns the sale.
	 */
	public Sale getSale() {
		return sale;
	}

	/**
	 * @param sale
	 *            The sale to set.
	 */
	public void setSale(Sale sale) {
		this.sale = sale;
	}

}
