package com.jasamedika.medifirst2000.entities;

import java.io.Serializable;
import org.hibernate.envers.Audited;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.*;

import org.hibernate.validator.constraints.NotEmpty;

import com.jasamedika.medifirst2000.base.BaseMaster;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.internal.util.logging.Messages;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import org.hibernate.envers.Audited;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 * class Produk
 * 
 * @author Generator
 */
@Entity // @Audited
@Table(name = "ProdukDetailLaboratorium_M")
public class ProdukDetailLaboratorium extends BaseMaster {

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectSatuanStandarFK")
	@Caption(value = "Satuan Standar")
	private SatuanStandar satuanStandar;

	public SatuanStandar getSatuanStandar() {
		return satuanStandar;
	}

	public void setSatuanStandar(SatuanStandar satuanStandar) {
		this.satuanStandar = satuanStandar;
	}

	@Column(name = "ObjectSatuanStandarFK", insertable = false, updatable = false)
	private Integer satuanStandarFk;

	@JsonBackReference
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "produkDetailLaboratorium")
	private Set<ProdukDetailLaboratoriumNilaiNormal> produkNilaiNormal = new HashSet<ProdukDetailLaboratoriumNilaiNormal>();

	public Set<ProdukDetailLaboratoriumNilaiNormal> getProdukNilaiNormal() {
		return produkNilaiNormal;
	}

	public void setProdukNilaiNormal(Set<ProdukDetailLaboratoriumNilaiNormal> produkDetail) {
		this.produkNilaiNormal = produkDetail;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ProdukFk")
	@Caption(value = "Produk")
	private Produk produk;

	public Produk getProduk() {
		return produk;
	}

	public void setProduk(Produk produk) {
		this.produk = produk;
	}

	@Column(name = "ProdukFk", insertable = false, updatable = false)
	private Integer produkFk;

	public String getDetailPemeriksaan() {
		return detailPemeriksaan;
	}

	public void setDetailPemeriksaan(String detailPemeriksaan) {
		this.detailPemeriksaan = detailPemeriksaan;
	}

	public MetodePemeriksaanPenunjang getMetodePemeriksaanPenunjang() {
		return metodePemeriksaanPenunjang;
	}

	public void setMetodePemeriksaanPenunjang(MetodePemeriksaanPenunjang metodePemeriksaanPenunjang) {
		this.metodePemeriksaanPenunjang = metodePemeriksaanPenunjang;
	}

	@Caption(value = "Detail Pemeriksaan")
	@Column(name = "detailPemeriksaan", nullable = true, length = 300)
	private String detailPemeriksaan;

	@ManyToOne
	@JoinColumn(name = "MetodePemeriksaanPenunjangFk")
	@Caption(value = "MetodePemeriksaanPenunjang")
	private MetodePemeriksaanPenunjang metodePemeriksaanPenunjang;

	@Column(name = "MetodePemeriksaanPenunjangFk", insertable = false, updatable = false)
	private Integer metodePemeriksaanPenunjangId;

	// -----------------------------add by
	// Pratama--------------------------------------//
	@JsonManagedReference
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "produkDetail")
	private Set<ProdukDetailLaboratoriumHasil> produkDetailHasilSet = new HashSet<ProdukDetailLaboratoriumHasil>();

	public Set<ProdukDetailLaboratoriumHasil> getProdukDetailHasilSet() {
		return produkDetailHasilSet;
	}

	public void setProdukDetailHasilSet(Set<ProdukDetailLaboratoriumHasil> produkDetailHasilSet) {
		this.produkDetailHasilSet = produkDetailHasilSet;
	}

	// -------------------------end add by
	// Pratama--------------------------------------//

	@Caption(value = "qCharDetailPemeriksaan")
	@Column(name = "qCharDetailPemeriksaan", nullable = true, length = 300)
	private String qCharDetailPemeriksaan;

	public String getqCharDetailPemeriksaan() {
		return qCharDetailPemeriksaan;
	}

	public void setqCharDetailPemeriksaan(String qCharDetailPemeriksaan) {
		this.qCharDetailPemeriksaan = qCharDetailPemeriksaan;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "public.produkdetaillaboratorium_m_id_seq")
	@javax.persistence.SequenceGenerator(name = "public.produkdetaillaboratorium_m_id_seq", sequenceName = "public.produkdetaillaboratorium_m_id_seq", allocationSize = 1)
	@Column(name = "id")
	protected Integer id;

	public Integer getId() {

		return id;
	}

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