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 javax.validation.constraints.NotNull;

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

@Entity
@Table(name="GeneralCheckUp_T")
public class GeneralCheckUp extends BaseTransaction{
	@ManyToOne
	@JoinColumn(name = "ObjectPegawaiFk")
	@NotNull(message="Pegawai tidak boleh kosong")
	@Caption(value="Pegawai")
	private Pegawai pegawai;
	
	@Column(name = "ObjectPegawaiFk", insertable=false,updatable=false,nullable=false)
	private Integer pegawaiId;
	
	@JsonManagedReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "generalCheckUp")
	@Caption(value = "dataGeneralCheckUpSet")
	private Set<DataGeneralCheckUp> dataGeneralCheckUpSet=new HashSet<DataGeneralCheckUp>();
	
	public Pegawai getPegawai() {
		return pegawai;
	}

	public void setPegawai(Pegawai pegawai) {
		this.pegawai = pegawai;
	}

	public Set<DataGeneralCheckUp> getDataGeneralCheckUpSet() {
		return dataGeneralCheckUpSet;
	}

	public void setDataGeneralCheckUpSet(Set<DataGeneralCheckUp> dataGeneralCheckUpSet) {
		this.dataGeneralCheckUpSet = dataGeneralCheckUpSet;
	}

}
