package jpa;

import java.io.Serializable;

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.Patient")
public class PatientJPA implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(updatable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	@Column(nullable = false, unique = true)
	private String personalIdentificationCode;
	private String nif;
	private String name;
	private String surname;
	private String password;
	private String email;
	@ManyToOne
	@JoinColumn(name = "FamilyDoctorId")
	private FamilyDoctorJPA familyDoctor;

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

	public PatientJPA(String pic, String nif, String name, String surname, String password, String email, FamilyDoctorJPA familyDoc) {
		this.personalIdentificationCode = pic;
		this.nif = nif;
		this.name = name;
		this.surname = surname;
		this.password = password;
		this.email = email;
		this.familyDoctor = familyDoc;
	}

	public Integer getId() {
		return id;
	}

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

	public String getNif() {
		return nif;
	}

	public void setNif(String value) {
		this.nif = value;
	}

	public String getName() {
		return name;
	}

	public void setName(String value) {
		this.name = value;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public FamilyDoctorJPA getFamilyDoctor() {
		return familyDoctor;
	}

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

	public String getPersonalIdentificationCode() {
		return personalIdentificationCode;
	}

	public void setPersonalIdentificationCode(String personalIdentificationCode) {
		this.personalIdentificationCode = personalIdentificationCode;
	}
}
