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.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
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;

@Entity
@Table(name="PengkajianAwal_M")
public class PengkajianAwal extends BaseMaster{
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "public.pengkajianawal_id_seq")
	@javax.persistence.SequenceGenerator(name = "public.pengkajianawal_id_seq", sequenceName = "public.pengkajianawal_id_seq", allocationSize = 1)
	@Column(name = "id")
	protected Integer id;

	@Caption(value="Nama")
	@Column(name="Nama", nullable=true)
	private String nama;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@Caption(value="Head Pengkajian Awal")
	@JoinColumn(name="headPengkajianAwalFk")
	private PengkajianAwal headPengkajianAwal;
	
	@Column(name="headPengkajianAwalFk", insertable=false, updatable=false, nullable=true)
	private Integer headPengkajianAwalId;
	
	@Caption(value="Desc/Nilai")
	@Column(name="DescNilai", nullable=true)
	private String descNilai;
	
	@Caption(value="NoUrut")
	@Column(name="NoUrut", nullable=true)
	private Integer noUrut;
	
	@JsonBackReference
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "headPengkajianAwal")
	private Set<PengkajianAwal> pengkajianAwal = new HashSet<>();

	public Integer getId() {
		return id;
	}

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

	public String getNama() {
		return nama;
	}

	public void setNama(String nama) {
		this.nama = nama;
	}

	public PengkajianAwal getHeadPengkajianAwal() {
		return headPengkajianAwal;
	}

	public void setHeadPengkajianAwal(PengkajianAwal headPengkajianAwal) {
		this.headPengkajianAwal = headPengkajianAwal;
	}

	public Integer getHeadPengkajianAwalId() {
		return headPengkajianAwalId;
	}

	public void setHeadPengkajianAwalId(Integer headPengkajianAwalId) {
		this.headPengkajianAwalId = headPengkajianAwalId;
	}

	public String getDescNilai() {
		return descNilai;
	}

	public void setDescNilai(String descNilai) {
		this.descNilai = descNilai;
	}

	public Integer getNoUrut() {
		return noUrut;
	}

	public void setNoUrut(Integer noUrut) {
		this.noUrut = noUrut;
	}

	public Set<PengkajianAwal> getPengkajianAwal() {
		return pengkajianAwal;
	}

	public void setPengkajianAwal(Set<PengkajianAwal> pengkajianAwal) {
		this.pengkajianAwal = pengkajianAwal;
	}
	
}
