/*-----------------------------------------------------------------------------------------
    Copyright (c)2000 TogetherSoft Corporation. Patents pending. All rights reserved.
-----------------------------------------------------------------------------------------*/

package ProblemDomain;

import java.math.BigDecimal;

/**
 * @author TogetherSoft
 * @stereotype mi-detail */
public class CashSaleDetail {

    /** This indicates how many of this item are being purchased. */
    private int qty;

    /**
     * This would allow you to use units like: each, pounds, case. Of course, you would have to have the intelligence on the
     * product pricing side as well. We won't be using this <g>.
     */
    private int UOM = 0;
    //    private BigDecimal negotiatedPrice;

    /**
     * This is the item being scanned in/sold. This object holds all the pertinent details.
     * @clientCardinality 0..*
     * @supplierCardinality 1
     */
    private ProductDesc product;

/* ========================================
 * Constructors
 * ======================================== */

    public CashSaleDetail(ProductDesc prod) {
        product = prod;
        qty = 1;
    }

/* ========================================
 * Business Methods
 * ======================================== */

    public BigDecimal calcTotal() {
        return product.calcPriceForQty(qty);
    }

    public boolean verifyAvailability() {
        return false;
    }

    public void deductQty() {
    }

/* ========================================
 * Accessor/Mutator Methods
 * ======================================== */

    public int getQty() {
        return qty;
    }

    public void setQty(int aQty) {
        qty = aQty;
    }

    public ProductDesc getProductDesc() {
        // Should probably return a clone to be safer.
        return product;
    }
} // ENDCLASS CashSaleDetail

