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.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 JenisAlatKesehatan
 * 
 * @author Generator
 */
@Entity // @Audited
@Table(name = "JenisAlatKesehatan_M")
public class JenisAlatKesehatan extends BaseMaster {
	@NotNull(message = "Jenis Alkes tidak boleh kosong")
	@Column(name = "JenisAlkes", nullable = false, length = 100)
	@Caption(value = "Jenis Alkes")
	private String jenisAlkes;

	public void setJenisAlkes(String jenisAlkes) {
		this.jenisAlkes = jenisAlkes;
	}

	public String getJenisAlkes() {
		return this.jenisAlkes;
	}

	@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 Alkes tidak boleh kosong")
	@Column(name = "KdJenisAlkes", nullable = false)
	@Caption(value = "Kode Jenis Alkes")
	private Byte kdJenisAlkes;

	public void setKdJenisAlkes(Byte kdJenisAlkes) {
		this.kdJenisAlkes = kdJenisAlkes;
	}

	public Byte getKdJenisAlkes() {
		return this.kdJenisAlkes;
	}

	/*
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL,
	 * mappedBy="kdjenisalkes") private Set<AlatKesehatan> AlatKesehatanSet =
	 * new HashSet<AlatKesehatan>();
	 * 
	 * public Set<AlatKesehatan> getAlatKesehatanSet() { return
	 * AlatKesehatanSet; }
	 * 
	 * public void setAlatKesehatanSet(Set<AlatKesehatan> alatKesehatanSet) {
	 * AlatKesehatanSet = alatKesehatanSet; }
	 */

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

	public Integer getId() {

		return id;
	}

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