package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.base.BaseActive;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

/**
 * @author salmanoe
 * @since Dec 2, 2021
 */
@Getter
@Setter
@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;

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

}
