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.base.BaseActive;
import com.jasamedika.medifirst2000.helper.Caption;

/**
 * @author salmanoe
 * @since Dec 2, 2021
 */
@Entity
@Table(name = "departementounitkerja_m")
public class DepartemenToUnitKerja extends BaseActive {

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "departemenfk")
	@Caption(value = "Departemen")
	private Departemen departemen;

	@Column(name = "departemenfk", insertable = false, updatable = false, nullable = false)
	private Integer departemenId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "unitkerjafk")
	@Caption(value = "Unit Kerja")
	private UnitKerjaPegawai unitKerja;

	@Column(name = "unitkerjafk", insertable = false, updatable = false, nullable = false)
	private Integer unitKerjaId;

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

	public Departemen getDepartemen() {
		return departemen;
	}

	public void setDepartemen(Departemen departemen) {
		this.departemen = departemen;
	}

	public Integer getDepartemenId() {
		return departemenId;
	}

	public void setDepartemenId(Integer departemenId) {
		this.departemenId = departemenId;
	}

	public UnitKerjaPegawai getUnitKerja() {
		return unitKerja;
	}

	public void setUnitKerja(UnitKerjaPegawai unitKerja) {
		this.unitKerja = unitKerja;
	}

	public Integer getUnitKerjaId() {
		return unitKerjaId;
	}

	public void setUnitKerjaId(Integer unitKerjaId) {
		this.unitKerjaId = unitKerjaId;
	}

	public Integer getId() {
		return id;
	}

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

	@Override
	public String toString() {
		return "DepartemenToUnitKerja [id=" + id + ", departemenId=" + departemenId + ", unitKerjaId=" + unitKerjaId
				+ "]";
	}

}
