package com.planimod.core;

import javax.persistence.Entity;

import com.patrikdufresne.managers.ArchivableObject;

/**
 * The Product class represent one product that may be schedule.
 */
@Entity
public class Product extends ArchivableObject {

	/**
	 * Family property
	 */
	public static final String FAMILY = "family"; //$NON-NLS-1$

	/**
	 * Name property
	 */
	public static final String NAME = "name"; //$NON-NLS-1$
	/**
	 * RefId property
	 */
	public static final String REFID = "refId"; //$NON-NLS-1$
	private static final long serialVersionUID = 1833794757829504482L;

	/**
	 * Define the product family.
	 */
	private String family;

	/**
	 * Define the product's name.
	 * 
	 */
	private String name;

	/**
	 * Define a reference number to the product.
	 * 
	 */
	private String refId;

	public String getFamily() {
		return this.family;
	}

	/**
	 * Getter of the property <tt>name</tt>
	 * 
	 * @return Returns the name.
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * Getter of the property <tt>refId</tt>
	 * 
	 * @return Returns the refId.
	 */
	public String getRefId() {
		return this.refId;
	}

	public void setFamily(String family) {
		this.changeSupport.firePropertyChange(FAMILY, this.family,
				this.family = family);
	}

	/**
	 * Setter of the property <tt>name</tt>
	 * 
	 * @param name
	 *            The name to set.
	 */
	public void setName(String name) {
		this.changeSupport
				.firePropertyChange(NAME, this.name, this.name = name);
	}

	/**
	 * Setter of the property <tt>refId</tt>
	 * 
	 * @param refId
	 *            The refId to set.
	 */
	public void setRefId(String refId) {
		this.changeSupport.firePropertyChange(REFID, this.refId,
				this.refId = refId);
	}

	@Override
	public String toString() {
		return "Product [id=" + this.id + ", name=" + this.name + ", refId=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				+ this.refId + "]"; //$NON-NLS-1$
	}

}
