package oracle.byop.maf.data.entities;

import java.util.Date;

import oracle.adfmf.java.beans.PropertyChangeListener;
import oracle.adfmf.java.beans.PropertyChangeSupport;

/**
 *
 * Title:   Bring Your Own Project (BYOP): Hackathon
 * Schema:  ADF Summit
 * Type:    Entity
 *
 * @author Frank Nimphius - August, 2014
 */

public class Inventory {
    
    private Integer productId = null;
    private Integer warehouseId = null;
    private Integer amountInStock = null;
    private Integer reorderPoint = null;
    private Integer maxInStock = null;
    private String outOfStockExplanation = null;
    private Date restockDate = null;
    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);


    public Inventory() {
        super();
    }


    public Inventory(Integer productId, Integer warehouseId,Integer amountInStock, Integer reorderPoint, Integer maxInStock,
                     String outOfStockExplanation, Date restockDate){
        super();
        
        this.productId = productId;
        this.warehouseId = warehouseId;
        this.amountInStock = amountInStock;
        this.reorderPoint = reorderPoint;
        this.maxInStock = maxInStock;
        this.outOfStockExplanation = outOfStockExplanation ;
        this.restockDate = restockDate;
    }


    public void setProductId(Integer productId) {
        Integer oldProductId = this.productId;
        this.productId = productId;
        propertyChangeSupport.firePropertyChange("productId", oldProductId, productId);
    }

    public Integer getProductId() {
        return productId;
    }

    public void setWarehouseId(Integer warehouseId) {
        Integer oldWarehouseId = this.warehouseId;
        this.warehouseId = warehouseId;
        propertyChangeSupport.firePropertyChange("warehouseId", oldWarehouseId, warehouseId);
    }

    public Integer getWarehouseId() {
        return warehouseId;
    }

    public void setAmountInStock(Integer amountInStock) {
        Integer oldAmountInStock = this.amountInStock;
        this.amountInStock = amountInStock;
        propertyChangeSupport.firePropertyChange("amountInStock", oldAmountInStock, amountInStock);
    }

    public Integer getAmountInStock() {
        return amountInStock;
    }

    public void setReorderPoint(Integer reorderPoint) {
        Integer oldReorderPoint = this.reorderPoint;
        this.reorderPoint = reorderPoint;
        propertyChangeSupport.firePropertyChange("reorderPoint", oldReorderPoint, reorderPoint);
    }

    public Integer getReorderPoint() {
        return reorderPoint;
    }

    public void setMaxInStock(Integer maxInStock) {
        Integer oldMaxInStock = this.maxInStock;
        this.maxInStock = maxInStock;
        propertyChangeSupport.firePropertyChange("maxInStock", oldMaxInStock, maxInStock);
    }

    public Integer getMaxInStock() {
        return maxInStock;
    }

    public void setOutOfStockExplanation(String outOfStockExplanation) {
        String oldOutOfStockExplanation = this.outOfStockExplanation;
        this.outOfStockExplanation = outOfStockExplanation;
        propertyChangeSupport.firePropertyChange("outOfStockExplanation", oldOutOfStockExplanation,
                                                 outOfStockExplanation);
    }

    public String getOutOfStockExplanation() {
        return outOfStockExplanation;
    }

    public void setRestockDate(Date restockDate) {
        Date oldRestockDate = this.restockDate;
        this.restockDate = restockDate;
        propertyChangeSupport.firePropertyChange("restockDate", oldRestockDate, restockDate);
    }

    public Date getRestockDate() {
        return restockDate;
    }

    public void addPropertyChangeListener(PropertyChangeListener l) {
        propertyChangeSupport.addPropertyChangeListener(l);
    }

    public void removePropertyChangeListener(PropertyChangeListener l) {
        propertyChangeSupport.removePropertyChangeListener(l);
    }
}
