package com.jasamedika.medifirst2000.entities;

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

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

import static javax.persistence.CascadeType.ALL;
import static javax.persistence.FetchType.LAZY;
import static javax.persistence.GenerationType.SEQUENCE;

@Getter
@Setter
@Entity
@Table(name = "K3FacillityCheck_M")
public class K3FacillityCheck extends BaseMaster {

	@Caption(value = "Facillity Check")
	@Column(name = "FacillityCheck", length = 50, nullable = false)
	private String facillityCheck;

	@JsonBackReference
	@OneToMany(cascade = ALL, fetch = LAZY, mappedBy = "k3FacillityCheck")
	private Set<K3KelompokLpjGedung> k3KelompokLpjGedung = new HashSet<>();

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

}