/**
 * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Component of: Red Hat Application Server
 * 
 * Initial Developers: Aizaz Ahmed
 *                     Vivek Lakshmanan
 *                     Andrew Overholt
 *                     Matthew Wringe
 *
 */
package olstore.dto;
import java.io.Serializable;
import java.math.BigDecimal;

import olstore.entity.ItemLocal;

public class ShoppingCartItem implements Serializable{
    private Integer itemId;
    private String name;
    private BigDecimal price;
    private BigDecimal unitPrice;
    // Should have been float, however, illegal input like strings in quantity
    // text box result in the interpretation of such input as 0 and that has
    // special meaning for the checkout system 
    // (suggests removal of the item) so in order to avoid such awkwardness
    // quantity was converted to being a String.
    private String quantity;
    
    public ShoppingCartItem(){
        itemId = null;
        name = null;
        price = null;
        quantity = null;
    }
    
    public ShoppingCartItem(ItemLocal item){
        itemId  = item.getItemId();
        name = item.getName();
        unitPrice = item.getPrice();
        price = new BigDecimal(0);		
    }
    
    public String toString(){
        return ("itemId="+ itemId + "\tname=" + name + "\tprice=" + price + "\tunitPrice=" + unitPrice + "\tquantity=" + quantity);
        
    }
    
    public Integer getItemId(){
        return itemId;
    }
    
    public String getName () {
        return name ;
    }
    
    public void setName ( String name) {
        this.name = name;
    }
    
    public BigDecimal getPrice () {
        return price;
    }
    
    public void setPrice ( BigDecimal price ) {
        this.price = price;
    }
    
    public String getQuantity () {
        return quantity;
    }
    
    public void setQuantity ( String quantity) {
        this.quantity = quantity;
    }
    
    
}
