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 = "IpsrsJenisPemakaian_M")
public class IpsrsJenisPemakaian extends BaseMaster {

	@Caption(value = "JenisPemakaian")
	@Column(name = "JenisPemakaian", nullable = false)
	private String jenisPemakaian;

	@JsonBackReference
	@OneToMany(cascade = ALL, fetch = LAZY, mappedBy = "ipsrsJenisPemakaian")
	Set<IpsrsKapasitasJenisPemakaian> ipsrsKapasitasJenisPemakaian = new HashSet<>();

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

}