package com.jasamedika.medifirst2000.entities;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import static javax.persistence.FetchType.LAZY;

@Getter
@Setter
@Entity
@Table(name = "MapPegawaiLimbah_T")
public class MapPegawaiLimbah extends BaseTransaction {

	@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectPetugasFk")
	@NotNull(message = "Petugas tidak boleh kosong")
	@Caption(value = "Object Petugas")
	private Pegawai petugas;

	@Column(name = "ObjectPetugasFk", insertable = false, updatable = false, nullable = false)
	private Integer petugasId;

	@JsonBackReference
	@ManyToOne
	@JoinColumn(name = "ObjectLimbahB3MasukFk")
	@Caption(value = "Object Limbah B3 Masuk")
	private LimbahB3Masuk limbahB3Masuk;

	@Column(name = "ObjectLimbahB3MasukFk", columnDefinition = "CHAR(32)", insertable = false, updatable = false)
	private String ObjectLimbahB3MasukId;

}
