package com.jasamedika.medifirst2000.entities;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.jasamedika.medifirst2000.helper.Caption;import org.hibernate.envers.Audited;

@Entity //@Audited
@Table(name = "RiwayatKesehatan_T")
public class RiwayatKesehatan extends MedicalRecordTransaction{
	
	@Column(name = "pernahDirawat", nullable = true)
	@Caption(value = "pernahDirawat")
	private boolean pernahDirawat;
	
	@Column(name = "terpasangAlatImplan", nullable = true)
	@Caption(value = "terpasangAlatImplan")
	private boolean terpasangAlatImplan;
	
	@Column(name = "riwayatPenyakitMayor", nullable = true)
	@Caption(value = "riwayatPenyakitMayor")
	private boolean riwayatPenyakitMayor;
	
	@ManyToOne
	@JoinColumn(name = "ObjectDataPenyakitMayorFk")
	@Caption(value = "ID DataPenyakitMayor")
	//@NotNull(message = "ID HasilTriase tidak boleh kosong")
	private DataPenyakitMayor dataPenyakitMayor;
	
	@Column(name = "ObjectDataPenyakitMayorFk", insertable = false, updatable = false, nullable = true)
	private Integer dataPenyakitMayorId;
	
	@Column(name = "keterangan", nullable = true)
	@Caption(value = "keterangan")
	private String keterangan;
		
	@JsonBackReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "riwayatKesehatan")
	private Set<PernahDirawatDetail> PernahDirawatDetail = new HashSet<PernahDirawatDetail>();
	
	@Column(name = "tglInput", nullable = true)
	@Caption(value = "Tgl Input")
	private Date tglInput;

	public Date getTglInput() {
		return tglInput;
	}

	public void setTglInput(Date tglInput) {
		this.tglInput = tglInput;
	}

	public boolean isPernahDirawat() {
		return pernahDirawat;
	}

	public void setPernahDirawat(boolean pernahDirawat) {
		this.pernahDirawat = pernahDirawat;
	}

	public boolean isTerpasangAlatImplan() {
		return terpasangAlatImplan;
	}

	public void setTerpasangAlatImplan(boolean terpasangAlatImplan) {
		this.terpasangAlatImplan = terpasangAlatImplan;
	}

	public boolean isRiwayatPenyakitMayor() {
		return riwayatPenyakitMayor;
	}

	public void setRiwayatPenyakitMayor(boolean riwayatPenyakitMayor) {
		this.riwayatPenyakitMayor = riwayatPenyakitMayor;
	}

	public DataPenyakitMayor getDataPenyakitMayor() {
		return dataPenyakitMayor;
	}

	public void setDataPenyakitMayor(DataPenyakitMayor dataPenyakitMayor) {
		this.dataPenyakitMayor = dataPenyakitMayor;
	}


	public Integer getDataPenyakitMayorId() {
		return dataPenyakitMayorId;
	}

	public void setDataPenyakitMayorId(Integer dataPenyakitMayorId) {
		this.dataPenyakitMayorId = dataPenyakitMayorId;
	}

	public String getKeterangan() {
		return keterangan;
	}

	public void setKeterangan(String keterangan) {
		this.keterangan = keterangan;
	}

	public Set<PernahDirawatDetail> getPernahDirawatDetail() {
		return PernahDirawatDetail;
	}

	public void setPernahDirawatDetail(Set<PernahDirawatDetail> pernahDirawatDetail) {
		PernahDirawatDetail = pernahDirawatDetail;
	}
	
	
}
