package oracle.byop.maf.data.entities;

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 Product {
    
    private Integer id = null;
    private String name= null;
    private String shortdesc = null;
    private Integer imageId = null;
    private Integer categoryId = null; 
    private Double suggestedPrice = null;
    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);

    public Product() {
        super();
    }
    
   public Product(Integer id, String name, String shortDesc, Integer imageId, Integer categoryId,Double suggestedPrice) {
        super();
        this.id = id;
        this.name = name;
        this.shortdesc = shortDesc;
        this.imageId = imageId;
        this.categoryId = categoryId;
        this.suggestedPrice = suggestedPrice;
    }


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

    public Integer getId() {
        return id;
    }

    public void setName(String name) {
        String oldName = this.name;
        this.name = name;
        propertyChangeSupport.firePropertyChange("name", oldName, name);
    }

    public String getName() {
        return name;
    }

    public void setShortdesc(String shortdesc) {
        String oldShortdesc = this.shortdesc;
        this.shortdesc = shortdesc;
        propertyChangeSupport.firePropertyChange("shortdesc", oldShortdesc, shortdesc);
    }

    public String getShortdesc() {
        return shortdesc;
    }

    public void setImageId(Integer imageId) {
        Integer oldImageId = this.imageId;
        this.imageId = imageId;
        propertyChangeSupport.firePropertyChange("imageId", oldImageId, imageId);
    }

    public Integer getImageId() {
        return imageId;
    }

    public void setCategoryId(Integer categoryId) {
        Integer oldCategoryId = this.categoryId;
        this.categoryId = categoryId;
        propertyChangeSupport.firePropertyChange("categoryId", oldCategoryId, categoryId);
    }

    public Integer getCategoryId() {
        return categoryId;
    }

    public void setSuggestedPrice(Double suggestedPrice) {
        Double oldSuggestedPrice = this.suggestedPrice;
        this.suggestedPrice = suggestedPrice;
        propertyChangeSupport.firePropertyChange("suggestedPrice", oldSuggestedPrice, suggestedPrice);
    }

    public Double getSuggestedPrice() {
        return suggestedPrice;
    }

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

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