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 Order {
    
    private Integer id = null;
    private Integer customerId = null;
    private Date dateOrdered = null;
    private Date dateShipped = null;
    private Integer salesRepId = null;
    private Double total = null;
    private Integer paymentTypeId = null;
    private Integer paymentOptionId = null;
    private String orderFilled = null;
    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);


    public Order() {
        super();
    }

    public Order(Integer id, Integer customerId, Date dateOrdered, Date dateShipped, Integer salesRepId, Double total,
                 Integer paymentTypeId, Integer paymentOptionId, String orderFilled) {
        super();
        
        this.id = id;
        this.customerId = customerId;
        this.dateOrdered = dateOrdered;
        this.dateShipped = dateShipped;
        this.salesRepId = salesRepId;
        this.total = total;
        this.paymentTypeId = paymentTypeId;
        this.paymentOptionId = paymentOptionId;
        this.orderFilled = orderFilled;
        
    }


    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        propertyChangeSupport.firePropertyChange("id", oldId, id);
    }

    public Integer getId() {
        return id;
    }

    public void setCustomerId(Integer customerId) {
        Integer oldCustomerId = this.customerId;
        this.customerId = customerId;
        propertyChangeSupport.firePropertyChange("customerId", oldCustomerId, customerId);
    }

    public Integer getCustomerId() {
        return customerId;
    }

    public void setDateOrdered(Date dateOrdered) {
        Date oldDateOrdered = this.dateOrdered;
        this.dateOrdered = dateOrdered;
        propertyChangeSupport.firePropertyChange("dateOrdered", oldDateOrdered, dateOrdered);
    }

    public Date getDateOrdered() {
        return dateOrdered;
    }

    public void setDateShipped(Date dateShipped) {
        Date oldDateShipped = this.dateShipped;
        this.dateShipped = dateShipped;
        propertyChangeSupport.firePropertyChange("dateShipped", oldDateShipped, dateShipped);
    }

    public Date getDateShipped() {
        return dateShipped;
    }

    public void setSalesRepId(Integer salesRepId) {
        Integer oldSalesRepId = this.salesRepId;
        this.salesRepId = salesRepId;
        propertyChangeSupport.firePropertyChange("salesRepId", oldSalesRepId, salesRepId);
    }

    public Integer getSalesRepId() {
        return salesRepId;
    }

    public void setTotal(Double total) {
        Double oldTotal = this.total;
        this.total = total;
        propertyChangeSupport.firePropertyChange("total", oldTotal, total);
    }

    public Double getTotal() {
        return total;
    }

    public void setPaymentTypeId(Integer paymentTypeId) {
        Integer oldPaymentTypeId = this.paymentTypeId;
        this.paymentTypeId = paymentTypeId;
        propertyChangeSupport.firePropertyChange("paymentTypeId", oldPaymentTypeId, paymentTypeId);
    }

    public Integer getPaymentTypeId() {
        return paymentTypeId;
    }

    public void setPaymentOptionId(Integer paymentOptionId) {
        Integer oldPaymentOptionId = this.paymentOptionId;
        this.paymentOptionId = paymentOptionId;
        propertyChangeSupport.firePropertyChange("paymentOptionId", oldPaymentOptionId, paymentOptionId);
    }

    public Integer getPaymentOptionId() {
        return paymentOptionId;
    }

    public void setOrderFilled(String orderFilled) {
        String oldOrderFilled = this.orderFilled;
        this.orderFilled = orderFilled;
        propertyChangeSupport.firePropertyChange("orderFilled", oldOrderFilled, orderFilled);
    }

    public String getOrderFilled() {
        return orderFilled;
    }

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

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