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 BahanSample
 * 
 * @author Generator
 */
@Entity // @Audited
@Table(name = "BahanSample_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class BahanSample extends BaseMaster {
	@NotNull(message = "Kd Bahan Sample tidak boleh kosong")
	@Column(name = "KdBahanSample", nullable = false, length = 2)
	@Caption(value = "Kode Bahan Sample")
	private String kdBahanSample;

	public void setKdBahanSample(String kdBahanSample) {
		this.kdBahanSample = kdBahanSample;
	}

	public String getKdBahanSample() {
		return this.kdBahanSample;
	}

	// @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;

	@ManyToOne
	@JoinColumn(name = "ObjectSatuanKecilFk")

	@Caption(value = "Object Satuan Kecil")
	private SatuanKecil satuanKecil;

	public void setSatuanKecil(SatuanKecil satuanKecil) {
		this.satuanKecil = satuanKecil;
	}

	public SatuanKecil getSatuanKecil() {
		return this.satuanKecil;
	}

	@Column(name = "ObjectSatuanKecilFk", insertable = false, updatable = false, nullable = false)
	private Integer satuanKecilId;

	@NotNull(message = "Nama Bahan Sample tidak boleh kosong")
	@Column(name = "NamaBahanSample", nullable = false, length = 50)
	@Caption(value = "Nama Bahan Sample")
	private String namaBahanSample;

	public void setNamaBahanSample(String namaBahanSample) {
		this.namaBahanSample = namaBahanSample;
	}

	public String getNamaBahanSample() {
		return this.namaBahanSample;
	}

	@NotNull(message = "QBahan Sample tidak boleh kosong")
	@Column(name = "QBahanSample", nullable = false)
	@Caption(value = "QBahan Sample")
	private short qBahanSample;

	public void setqBahanSample(short qBahanSample) {
		this.qBahanSample = qBahanSample;
	}

	public short getqBahanSample() {
		return this.qBahanSample;
	}

	/*
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL,
	 * mappedBy="kdbahansample") 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.bahansample_m_id_seq")
	@javax.persistence.SequenceGenerator(name = "public.bahansample_m_id_seq", sequenceName = "public.bahansample_m_id_seq", allocationSize = 1)
	@Column(name = "id")
	protected Integer id;

	public Integer getId() {

		return id;
	}

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