package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

import static javax.persistence.GenerationType.SEQUENCE;

@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "JadwalRencanaPemeriksaan_M")
public class JadwalRencanaPemeriksaan extends BaseMaster {

	public JadwalRencanaPemeriksaan(Integer id, Integer pegawaiId, String pemeriksaan, Date tglPemeriksaan) {
		super();
		this.id = id;
		this.pegawaiId = pegawaiId;
		this.pemeriksaan = pemeriksaan;
		this.tglPemeriksaan = tglPemeriksaan;
	}

	@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;

	@Column(name = "pemeriksaan")
	@Caption(value = "Pemeriksaan")
	private String pemeriksaan;

	@Column(name = "tglPemeriksaan")
	@Caption(value = "Tanggal Pemeriksaan")
	private Date tglPemeriksaan;

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

}