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 javax.validation.constraints.NotNull;

import com.jasamedika.medifirst2000.base.BaseActive;
import com.jasamedika.medifirst2000.helper.Caption;

/**
 * @author salmanoe
 * @since Dec 31, 2021
 */
@Entity
@Table(name = "sdm_mapjabatanprofesi_m")
public class MapJabatanProfesi extends BaseActive {

	private static final long serialVersionUID = 3888545942252692215L;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "jabatanfk")
	@NotNull(message = "Jabatan harus diisi")
	@Caption(value = "Jabatan")
	private Jabatan jabatan;

	@Column(name = "jabatanfk", insertable = false, updatable = false, nullable = false)
	private Integer jabatanId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "profesifk")
	@NotNull(message = "Profesi harus diisi")
	@Caption(value = "Profesi")
	private Profesi profesi;

	@Column(name = "profesifk", insertable = false, updatable = false, nullable = false)
	private Integer profesiId;

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

	public Jabatan getJabatan() {
		return jabatan;
	}

	public void setJabatan(Jabatan jabatan) {
		this.jabatan = jabatan;
	}

	public Integer getJabatanId() {
		return jabatanId;
	}

	public void setJabatanId(Integer jabatanId) {
		this.jabatanId = jabatanId;
	}

	public Profesi getProfesi() {
		return profesi;
	}

	public void setProfesi(Profesi profesi) {
		this.profesi = profesi;
	}

	public Integer getProfesiId() {
		return profesiId;
	}

	public void setProfesiId(Integer profesiId) {
		this.profesiId = profesiId;
	}

	public Integer getId() {
		return id;
	}

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

}
