package com.jasamedika.medifirst2000.entities;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;

@Entity
@Table(name="KecelakaanKerja_T")
public class KecelakaanKerja extends BaseTransaction{
	//---------------------------------------------------Insiden----------------------------------------------//
	
	@Column(name="tglInsiden",nullable=false)
	@Caption(value="Tanggal Insiden")
	@NotNull(message="Tanggal Insiden tidak boleh kosong")
	private Date tglInsiden;
	
	@Column(name="waktuInsiden",nullable=false)
	@Caption(value="Waktu Insiden")
	@NotNull(message="Waktu Insiden tidak boleh kosong")
	private Date waktuInsiden;
	
	@Column(name="pekerjaan",nullable=true)
	@Caption(value="Pekerjaan")
	private String pekerjaan;
	
	@Column(name="lokasi",nullable=true)
	@Caption(value="Lokasi")
	private String lokasi;
	
	@Column(name="area",nullable=true)
	@Caption(value="Area")
	private String area;
	
	@Column(name="Kronologi",nullable=true)
	@Caption(value="Kronologi")
	private String kronologi;
	
	@Column(name="kerugianAset",nullable=true)
	@Caption(value="Kerugian Aset")
	private String kerugianAset;
	
	@Column(name="kerugianLingkungan",nullable=true)
	@Caption(value="Kerugian Lingkungan")
	private String kerugianLingkungan;
	
	@JsonManagedReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "kecelakaanKerja")
	@Caption(value = "korbanSet")
	private Set<Korban> korbanSet = new HashSet<Korban>();
	
	@JsonManagedReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "kecelakaanKerja")
	@Caption(value = "tindakanSet")
	private Set<TindakanKeselamatanKerja> tindakanKeselamatanKerja = new HashSet<TindakanKeselamatanKerja>();
	
	@JsonManagedReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "kecelakaanKerja")
	@Caption(value = "saksiSet")
	private Set<Saksi> saksiSet = new HashSet<Saksi>();
	
}
