package com.jasamedika.medifirst2000.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.jasamedika.medifirst2000.helper.Caption;

@Entity
@Table(name = "UnitKerjaPegawai_M")
public class UnitKerjaPegawai extends BaseKeyValueMaster {

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

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "objectjabatankepalafk")
	@Caption(value = "Jabatan Kepala")
	private Jabatan jabatanKepala;

	@Column(name = "objectjabatankepalafk", insertable = false, updatable = false, nullable = true)
	private Integer jabatanKepalaId;

	public UnitKerjaPegawai() {
	}

	public UnitKerjaPegawai(Integer id) {
		super();
		this.id = id;
	}

	public UnitKerjaPegawai(Integer id, String name) {
		super();
		this.id = id;
		this.setName(name);
	}

	public Integer getId() {
		return id;
	}

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

	public Jabatan getJabatanKepala() {
		return jabatanKepala;
	}

	public void setJabatanKepala(Jabatan jabatanKepala) {
		this.jabatanKepala = jabatanKepala;
	}

	public Integer getJabatanKepalaId() {
		return jabatanKepalaId;
	}

	public void setJabatanKepalaId(Integer jabatanKepalaId) {
		this.jabatanKepalaId = jabatanKepalaId;
	}
	
	@Override
	public String toString() {
		return "UnitKerjaPegawai [id=" + id + ", name=" + getName() + ", statusEnabled=" + statusEnabled + "]";
	}

}
