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 UnitKerja
 * 
 * @author Generator
 */
@Entity // @Audited
@Table(name = "UnitKerja_M")
public class UnitKerja extends BaseMaster {
	@Caption(value = "Kode Pimpinan")
	private String kdPimpinan;

	@Column(name = "KdPimpinan", nullable = true, length = 5)
	public String getKdPimpinan() {
		return kdPimpinan;
	}

	public void setKdPimpinan(String kdPimpinan) {
		this.kdPimpinan = kdPimpinan;
	}

	@Caption(value = "Kode Unit Kerja")
	private Byte kdUnitKerja;

	@NotNull(message = "Kd Unit Kerja tidak boleh kosong")
	@Column(name = "KdUnitKerja", nullable = false)
	public Byte getKdUnitKerja() {
		return kdUnitKerja;
	}

	public void setKdUnitKerja(Byte kdUnitKerja) {
		this.kdUnitKerja = kdUnitKerja;
	}

	@Caption(value = "No Unit Kerja")
	private String noUnitKerja;

	@Column(name = "NoUnitKerja", nullable = true, length = 50)
	public String getNoUnitKerja() {
		return noUnitKerja;
	}

	public void setNoUnitKerja(String noUnitKerja) {
		this.noUnitKerja = noUnitKerja;
	}

	@Caption(value = "QUnit Kerja")
	private Byte qUnitKerja;

	@NotNull(message = "QUnit Kerja Q Unit Kerja tidak boleh kosong")
	@Column(name = "QUnitKerjaQUnitKerja", nullable = false)
	public Byte getqUnitKerja() {
		return qUnitKerja;
	}

	public void setqUnitKerja(Byte qUnitKerja) {
		this.qUnitKerja = qUnitKerja;
	}

	@Caption(value = "Unit Kerja")
	private String namaUnitKerja;

	@NotNull(message = "Unit Kerja tidak boleh kosong")
	@Column(name = "UnitKerja", nullable = false, length = 100)
	public String getNamaUnitKerja() {
		return namaUnitKerja;
	}

	public void setNamaUnitKerja(String namaUnitKerja) {
		this.namaUnitKerja = namaUnitKerja;
	}

	/*
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy =
	 * "kdunitkerja") private Set<JenisSatuanKerja> JenisSatuanKerjaSet = new
	 * HashSet<JenisSatuanKerja>();
	 * 
	 * public Set<JenisSatuanKerja> getJenisSatuanKerjaSet() { return
	 * JenisSatuanKerjaSet; }
	 * 
	 * public void setJenisSatuanKerjaSet(Set<JenisSatuanKerja>
	 * jenisSatuanKerjaSet) { JenisSatuanKerjaSet = jenisSatuanKerjaSet; }
	 */

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

	public Integer getId() {

		return id;
	}

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