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 static javax.persistence.CascadeType.ALL;
import static javax.persistence.FetchType.LAZY;

@Getter
@Setter
@Entity
@Table(name = "K3LaporanKecelakaanKerja_T")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class K3LaporanKecelakaanKerja extends BaseTransaction {

	@ManyToOne(fetch = LAZY)
	@Caption(value = "Pelapor")
	@JoinColumn(name = "ObjectPelaporFk")
	private Pegawai pelapor;

	@Column(name = "ObjectPelaporFk", nullable = false, insertable = false, updatable = false)
	private Integer pelaporId;

	@JsonBackReference
	@OneToOne(cascade = ALL, fetch = LAZY, mappedBy = "k3LaporanKecelakaanKerja")
	private LkkIdentifikasiKejadian lkkIdentifikasiKejadian;

	@Caption(value = "Verifikasi")
	@Column(name = "Verifikasi")
	private Integer verifikasi;

}
