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.JsonManagedReference;
import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;

@Entity
@Table(name = "PAPriwayatImunisasi_T")
public class PapRiwayatImunisasi extends BaseTransaction {

	@ManyToOne
	@JoinColumn(name = "ObjectPasienFk")
	@NotNull(message = "Pasien tidak boleh kosong")
	private AntrianPasienDiPeriksa pasien;	
	
	@Column(name = "ObjectPasienFk", columnDefinition = "CHAR(32)", insertable = false, updatable = false, nullable = false)
	private String pasienId;
		
	@NotNull(message = "Tgl Input tidak boleh kosong")
	@Column(name = "tglInput", nullable = false)
	@Caption(value = "Tgl Input")
	private Date tglInput;

	@Column(name = "hasilImunisasi", nullable = true)
	@Caption(value = "hasilImunisasi")
	private String hasilImunisasi;

	@JsonManagedReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "papRiwayatImunisasi")
	@Caption(value = "papImunisasiDetailSet")
	private Set<PapImunisasiDetail> papImunisasiDetailSet=new HashSet<PapImunisasiDetail>();
	
	@Column(name = "keteranganLainnya", nullable = true)
	@Caption(value = "keteranganLainnya")
	private String keteranganLainnya;

	public AntrianPasienDiPeriksa getPasien() {
		return pasien;
	}

	public void setPasien(AntrianPasienDiPeriksa pasien) {
		this.pasien = pasien;
	}

	public Date getTglInput() {
		return tglInput;
	}

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

	public String getHasilImunisasi() {
		return hasilImunisasi;
	}

	public void setHasilImunisasi(String hasilImunisasi) {
		this.hasilImunisasi = hasilImunisasi;
	}

	public String getKeteranganLainnya() {
		return keteranganLainnya;
	}

	public void setKeteranganLainnya(String keteranganLainnya) {
		this.keteranganLainnya = keteranganLainnya;
	}

	public Set<PapImunisasiDetail> getPapImunisasiDetailSet() {
		return papImunisasiDetailSet;
	}

	public void setPapImunisasiDetailSet(Set<PapImunisasiDetail> papImunisasiDetailSet) {
		this.papImunisasiDetailSet = papImunisasiDetailSet;
	}
	
}
