package jpa;

import java.io.Serializable;
import java.sql.Time;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 
 * @author Marcos García Núñez (mgarcianun@uoc.edu)
 *
 */
@Entity
@Table(name = "MyHealth.Visit")
public class VisitJPA implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(updatable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	private Date date;
	private Time time;
	private String observations;
	private String result;
	
	@ManyToOne
	@JoinColumn(name = "FamilyDoctorId")
	private FamilyDoctorJPA familyDoctor;
	
	@ManyToOne
	@JoinColumn(name = "PatientId")
	private PatientJPA patient;

	/**
	 * Class constructor methods
	 */
	public VisitJPA() {
		super();
	}

	public VisitJPA(Integer id, Date date, Time time, String observations, String result, PatientJPA patient, FamilyDoctorJPA familydoctor) {
		this.id = id;
		this.date = date;
		this.time = time;
		this.observations = observations;
		this.result = result;
		this.patient = patient;
		this.familyDoctor = familydoctor;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer value) {
		this.id = value;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date value) {
		this.date = value;
	}

	public Time getTime() {
		return time;
	}

	public void setTime(Time value) {
		this.time = value;
	}

	public String getObservations() {
		return observations;
	}

	public void setObservations(String value) {
		this.observations = value;
	}

	/**
	 * Methods get/set persistent relationships
	 */
	public FamilyDoctorJPA getFamilyDoctor() {
		return familyDoctor;
	}

	public void setFamilyDoctor(FamilyDoctorJPA familyDoc) {
		this.familyDoctor = familyDoc;
	}

	public PatientJPA getPatient() {
		return patient;
	}

	public void setPatient(PatientJPA pat) {
		this.patient = pat;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String value) {
		this.result = value;
	}
}
