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.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

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

@Entity
@Table(name="K3CheckListFacillitySefety_T")
public class K3CheckListFacillitySefety extends BaseTransaction{
	
	@NotNull(message="Tanggal tidak boleh Kosong")
	@Caption(value="Tanggal")
	@Column(name="Tanggal", nullable=false)
	private Date tanggal;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@Caption(value="Ruangan")
	@JoinColumn(name="ObjectRuanganFK")
	private Ruangan ruangan;
	
	@Column(name="ObjectRuanganFK", nullable=false, insertable=false, updatable=false)
	private Integer ruanganId;

	@JsonBackReference
	@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="k3CheckListFacillitySefety")
	private Set<K3CheckListFacillitySefetyDetail> k3CheckListFacillitySefetyDetail = new HashSet<>();

	public Date getTanggal() {
		return tanggal;
	}

	public void setTanggal(Date tanggal) {
		this.tanggal = tanggal;
	}

	public Ruangan getRuangan() {
		return ruangan;
	}

	public void setRuangan(Ruangan ruangan) {
		this.ruangan = ruangan;
	}

	public Integer getRuanganId() {
		return ruanganId;
	}

	public void setRuanganId(Integer ruanganId) {
		this.ruanganId = ruanganId;
	}

	public Set<K3CheckListFacillitySefetyDetail> getK3CheckListFacillitySefetyDetail() {
		return k3CheckListFacillitySefetyDetail;
	}

	public void setK3CheckListFacillitySefetyDetail(
			Set<K3CheckListFacillitySefetyDetail> k3CheckListFacillitySefetyDetail) {
		this.k3CheckListFacillitySefetyDetail = k3CheckListFacillitySefetyDetail;
	}	
}

