package com.jasamedika.medifirst2000.entities;

import java.io.Serializable;
import org.hibernate.envers.Audited;
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.JsonIgnoreProperties;
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 JenisPeriksaPenunjang
 * 
 * @author Generator
 */
@Entity // @Audited
@Table(name = "JenisPeriksaPenunjang_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class JenisPeriksaPenunjang extends BaseMaster {
	@NotNull(message = "Jenis Periksa tidak boleh kosong")
	@Column(name = "JenisPeriksa", nullable = false, length = 50)
	@Caption(value = "Jenis Periksa")
	private String jenisPeriksa;

	public void setJenisPeriksa(String jenisPeriksa) {
		this.jenisPeriksa = jenisPeriksa;
	}

	public String getJenisPeriksa() {
		return this.jenisPeriksa;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectBahanSampleFk")
	@Caption(value = "Object Bahan Sample")
	private BahanSample bahanSample;

	public void setBahanSample(BahanSample bahanSample) {
		this.bahanSample = bahanSample;
	}

	public BahanSample getBahanSample() {
		return this.bahanSample;
	}

	@Column(name = "ObjectBahanSampleFk", insertable = false, updatable = false)
	private Integer bahanSampleId;

	@ManyToOne
	@JoinColumn(name = "ObjectDepartemenFk")
	@NotNull(message = "Kd Departemen tidak boleh kosong")

	@Caption(value = "Object Departemen")
	private Departemen departemen;

	public void setDepartemen(Departemen departemen) {
		this.departemen = departemen;
	}

	public Departemen getDepartemen() {
		return this.departemen;
	}

	@Column(name = "ObjectDepartemenFk", insertable = false, updatable = false)
	private Integer departemenId;

	@NotNull(message = "Kd Jenis Periksa tidak boleh kosong")
	@Column(name = "KdJenisPeriksa", nullable = false)
	@Caption(value = "Kode Jenis Periksa")
	private short kdJenisPeriksa;

	public void setKdJenisPeriksa(short kdJenisPeriksa) {
		this.kdJenisPeriksa = kdJenisPeriksa;
	}

	public short getKdJenisPeriksa() {
		return this.kdJenisPeriksa;
	}

	@ManyToOne
	@JoinColumn(name = "ObjectJenisPeriksaHeadFk")

	@Caption(value = "Object Jenis Periksa Head")
	private JenisPeriksaPenunjang jenisPeriksaHead;

	public void setJenisPeriksaHead(JenisPeriksaPenunjang jenisPeriksaHead) {
		this.jenisPeriksaHead = jenisPeriksaHead;
	}

	public JenisPeriksaPenunjang getJenisPeriksaHead() {
		return this.jenisPeriksaHead;
	}

	@Column(name = "ObjectJenisPeriksaHeadFk", insertable = false, updatable = false, nullable = false)
	private Integer jenisPeriksaHeadId;

	@NotNull(message = "No Urut tidak boleh kosong")
	@Column(name = "NoUrut", nullable = false)
	@Caption(value = "No Urut")
	private Byte noUrut;

	public void setNoUrut(Byte noUrut) {
		this.noUrut = noUrut;
	}

	public Byte getNoUrut() {
		return this.noUrut;
	}

	@NotNull(message = "QJenis Periksa tidak boleh kosong")
	@Column(name = "QJenisPeriksa", nullable = false)
	@Caption(value = "QJenis Periksa")
	private short qJenisPeriksa;

	public void setqJenisPeriksa(short qJenisPeriksa) {
		this.qJenisPeriksa = qJenisPeriksa;
	}

	public short getqJenisPeriksa() {
		return this.qJenisPeriksa;
	}

	/*
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL,
	 * mappedBy="kdjenisperiksahead") private Set<JenisPeriksaPenunjang>
	 * JenisPeriksaPenunjangSet = new HashSet<JenisPeriksaPenunjang>();
	 * 
	 * public Set<JenisPeriksaPenunjang> getJenisPeriksaPenunjangSet() { return
	 * JenisPeriksaPenunjangSet; }
	 * 
	 * public void setJenisPeriksaPenunjangSet(Set<JenisPeriksaPenunjang>
	 * jenisPeriksaPenunjangSet) { JenisPeriksaPenunjangSet =
	 * jenisPeriksaPenunjangSet; }
	 */

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

	public Integer getId() {

		return id;
	}

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