// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
package nosql.orientdb.object;

import java.math.BigDecimal;

public class OrderLine {
    private int itemNo;
    private String itemName;
    private BigDecimal itemPrice;
    private int quantity;
    public OrderLine() {
        this(0, "", BigDecimal.ZERO, 0);
    }
    public OrderLine(int itemsNo, String itemName, BigDecimal itemPrice, int quantity) {
        this.itemNo = itemsNo;
        this.itemName = itemName;
        this.itemPrice = itemPrice;
        this.quantity = quantity;
    }
    public int getItemNo() {
        return itemNo;
    }
    public void setItemNo(int itemNo) {
        this.itemNo = itemNo;
    }
    public String getItemName() {
        return itemName;
    }
    public void setItemName(String itemName) {
        this.itemName = itemName;
    }
    public BigDecimal getItemPrice() {
        return itemPrice;
    }
    public void setItemPrice(BigDecimal itemPrice) {
        this.itemPrice = itemPrice;
    }
    public int getQuantity() {
        return quantity;
    }
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
    public BigDecimal getPrice() {
        return itemPrice.multiply(new BigDecimal(quantity));
    }
    @Override
    public String toString() {
        return String.format("(%d,%s,%s,%d)",  itemNo, itemName, itemPrice, quantity);
    }
}
