package com.jasamedika.medifirst2000.entities;

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 com.fasterxml.jackson.annotation.JsonBackReference;
import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
@Table(name = "K3KelompokLpjGedung_M")
public class K3KelompokLpjGedung extends BaseMaster {

	@ManyToOne(fetch = FetchType.LAZY)
	@Caption(value = "K3 Facillity Check")
	@JoinColumn(name = "ObjectK3FacillityCheckFK")
	private K3FacillityCheck k3FacillityCheck;

	@Column(name = "ObjectK3FacillityCheckFK", nullable = false, insertable = false, updatable = false)
	private Integer k3FacillityCheckId;

	@Caption(value = "Nama Kelompok")
	@Column(name = "NamaKelompok", length = 50, nullable = false)
	private String namaKelompok;

	@JsonBackReference
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "k3KelompokLpjGedung")
	private Set<K3ItemPeriksaGedung> k3ItemPeriksaGedung = new HashSet<>();

	public K3FacillityCheck getK3FacillityCheck() {
		return k3FacillityCheck;
	}

	public void setK3FacillityCheck(K3FacillityCheck k3FacillityCheck) {
		this.k3FacillityCheck = k3FacillityCheck;
	}

	public Integer getK3FacillityCheckId() {
		return k3FacillityCheckId;
	}

	public void setK3FacillityCheckId(Integer k3FacillityCheckId) {
		this.k3FacillityCheckId = k3FacillityCheckId;
	}

	public String getNamaKelompok() {
		return namaKelompok;
	}

	public void setNamaKelompok(String namaKelompok) {
		this.namaKelompok = namaKelompok;
	}

	public Set<K3ItemPeriksaGedung> getK3ItemPeriksaGedung() {
		return k3ItemPeriksaGedung;
	}

	public void setK3ItemPeriksaGedung(Set<K3ItemPeriksaGedung> k3ItemPeriksaGedung) {
		this.k3ItemPeriksaGedung = k3ItemPeriksaGedung;
	}

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

	public Integer getId() {

		return id;
	}

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