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 Lokasi
 * 
 * @author Generator
 */
@Entity // @Audited
@Table(name = "Lokasi_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class Lokasi extends BaseMaster {
	@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 Lokasi tidak boleh kosong")
	@Column(name = "KdLokasi", nullable = false)
	@Caption(value = "Kode Lokasi")
	private short kdLokasi;

	public void setKdLokasi(short kdLokasi) {
		this.kdLokasi = kdLokasi;
	}

	public short getKdLokasi() {
		return this.kdLokasi;
	}

	@ManyToOne
	@JoinColumn(name = "ObjectLokasiHeadFk")

	@Caption(value = "Object Lokasi Head")
	private Lokasi lokasiHead;

	public void setLokasiHead(Lokasi lokasiHead) {
		this.lokasiHead = lokasiHead;
	}

	public Lokasi getLokasiHead() {
		return this.lokasiHead;
	}

	@Column(name = "ObjectLokasiHeadFk", insertable = false, updatable = false, nullable = false)
	private Integer lokasiHeadId;

	@NotNull(message = "Nama Lokasi tidak boleh kosong")
	@Column(name = "NamaLokasi", nullable = false, length = 30)
	@Caption(value = "Nama Lokasi")
	private String namaLokasi;

	public void setNamaLokasi(String namaLokasi) {
		this.namaLokasi = namaLokasi;
	}

	public String getNamaLokasi() {
		return this.namaLokasi;
	}

	@NotNull(message = "QLokasi tidak boleh kosong")
	@Column(name = "QLokasi", nullable = false)
	@Caption(value = "QLokasi")
	private short qLokasi;

	public void setqLokasi(short qLokasi) {
		this.qLokasi = qLokasi;
	}

	public short getqLokasi() {
		return this.qLokasi;
	}

	/*
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy =
	 * "kdlokasi") private Set<Dokumen> DokumenSet = new HashSet<Dokumen>();
	 * 
	 * public Set<Dokumen> getDokumenSet() { return DokumenSet; }
	 * 
	 * public void setDokumenSet(Set<Dokumen> dokumenSet) { DokumenSet =
	 * dokumenSet; }
	 */

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

	public Integer getId() {

		return id;
	}

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