package lu.tudor.santec.gecamed.formeditor.ejb.entity.beans;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import lu.tudor.santec.gecamed.core.ejb.entity.beans.GECAMedEntityBean;

@Entity
@Table (name = "form_value", schema = "formeditor")
//@NamedQueries({
//	@NamedQuery (name = "getValuesByFormId", query="SELECT OBJECT(o) FROM FormValue o WHERE o.formId = :formId"),
//	@NamedQuery (name=FormValue.VALUES_AND_DATE_OF_COMPONENT, query=
//			"SELECT v.value " +
//			"FROM Form f, FormValue v " +
//			"WHERE v.formId = f.id " +
//			"AND f.patientId = :patientId " +
//			"AND f.templateId = :templateId " +
//			"AND v.key = :key " +
//			"ORDER BY f.dateCreated DESC"),
//	@NamedQuery (name=FormValue.VALUES_AND_DATE_OF_COMPONENT_SINCE_DATE, query=
//			"SELECT v.value " +
//			"FROM Form f, FormValue v " +
//			"WHERE v.formId = f.id " +
//			"AND f.patientId = :patientId " +
//			"AND f.templateId = :templateId " +
//			"AND v.key = :key " +
//			"AND f.dateCreated > :date " +
//			"ORDER BY f.dateCreated DESC"),
//	@NamedQuery (name=FormValue.VALUES_OF_COMPONENT, query=
//			"SELECT f.dateCreated, v.value " +
//			"FROM Form f, FormValue v " +
//			"WHERE v.formId = f.id " +
//			"AND f.patientId = :patientId " +
//			"AND f.templateId = :templateId " +
//			"AND v.key = :key " +
//			"ORDER BY f.dateCreated DESC"),
//	@NamedQuery (name=FormValue.VALUES_OF_COMPONENT_SINCE_DATE, query=
//			"SELECT f.dateCreated, v.value " +
//			"FROM Form f, FormValue v " +
//			"WHERE v.formId = f.id " +
//			"AND f.patientId = :patientId " +
//			"AND f.templateId = :templateId " +
//			"AND v.key = :key " +
//			"AND f.dateCreated > :date " +
//			"ORDER BY f.dateCreated DESC")
//})
public class FormValue extends GECAMedEntityBean implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
//	public static final String VALUES_OF_COMPONENT = "valuesOfComponent";
//	public static final String VALUES_OF_COMPONENT_SINCE_DATE = "valuesOfComponentSinceDate";
//	public static final String VALUES_AND_DATE_OF_COMPONENT = "valuesAndDateOfComponent";
//	public static final String VALUES_AND_DATE_OF_COMPONENT_SINCE_DATE = "valuesAndDateOfComponentSinceDate";
//	public static final String VALUES_OF_COMPONENT_LATEST_FORMS = "valuesOfComponentLatestForms";
	
	/**
	 * the reference to the form, this value belongs to
	 */
	private Integer formId;
	
	/**
	 * the reference to the component, this value belongs to
	 */
	private String key;
	
	/**
	 * the text of the component
	 */
	private String value;
	
	@Column (name = "form_id")
	public Integer getFormId() {
		return formId;
	}
	public void setFormId(Integer formId) {
		this.formId = formId;
	}
	
	@Column (name = "key_name")
	public String getKey() {
		return key;
	}
	public void setKey(String key) {
		this.key = key;
	}
	
	@Column (name = "value")
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
}
