package com.jasamedika.medifirst2000.entities;

import java.util.Date;
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.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
@Table(name = "KajianEvaluasi_M")
public class KajianEvaluasi extends BaseMaster {

	@ManyToOne
	@JoinColumn(name = "ObjectUserFk")
	@NotNull(message = "User tidak boleh kosong")
	@Caption(value = "Kajian Evaluasi")
	private Pegawai user;

	@Column(name = "ObjectUserFk", insertable = false, updatable = false, nullable = false)
	private Integer userId;

	@Column(name = "noUsulan")
	@Caption(value = "Nomor Usulan")
	private String noUsulan;

	@Column(name = "tglUsulan")
	@Caption(value = "Tanggal Usulan")
	private Date tglUsulan;

	@Column(name = "kajian")
	@Caption(value = "Kajian")
	private String kajian;

	@Column(name = "usulan")
	@Caption(value = "Usulan")
	private String usulan;

	@JsonManagedReference
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "kajianId")
	@Caption(value = "detailKajianSet")
	private Set<DetailKajianEvaluasi> detailKajianSet = new HashSet<DetailKajianEvaluasi>();

	public Pegawai getUser() {
		return user;
	}

	public void setUser(Pegawai user) {
		this.user = user;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getNoUsulan() {
		return noUsulan;
	}

	public void setNoUsulan(String noUsulan) {
		this.noUsulan = noUsulan;
	}

	public Date getTglUsulan() {
		return tglUsulan;
	}

	public void setTglUsulan(Date tglUsulan) {
		this.tglUsulan = tglUsulan;
	}

	public String getKajian() {
		return kajian;
	}

	public void setKajian(String kajian) {
		this.kajian = kajian;
	}

	public String getUsulan() {
		return usulan;
	}

	public void setUsulan(String usulan) {
		this.usulan = usulan;
	}

	public Set<DetailKajianEvaluasi> getDetailKajianSet() {
		return detailKajianSet;
	}

	public void setDetailKajianSet(Set<DetailKajianEvaluasi> detailKajianSet) {
		this.detailKajianSet = detailKajianSet;
	}

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

	public Integer getId() {

		return id;
	}

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