package com.jasamedika.medifirst2000.entities;

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

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

import static javax.persistence.FetchType.LAZY;
import static javax.persistence.TemporalType.DATE;
import static javax.persistence.TemporalType.TIMESTAMP;

@Getter
@Setter
@Entity
@Table(name = "sdm_logbookkinerjadokter_t")
public class LogbookKinerjaDokter extends BaseTransaction {

	@Caption(value = "Bulan")
	@Column(name = "bulan", nullable = false)
	@Temporal(DATE)
	private Date bulan;

	@Caption(value = "Detail Target")
	@Column(name = "detailtarget", nullable = false)
	private Double detailTarget;

	@Caption(value = "Detail Capaian")
	@Column(name = "detailcapaian", columnDefinition = "float8 default 0")
	private Double detailCapaian;

	@ManyToOne(fetch = LAZY)
	@NotNull(message = "Pegawai tidak boleh kosong")
	@JoinColumn(name = "objectpegawaifk")
	@Caption(value = "Pegawai")
	private Pegawai pegawai;

	@Column(name = "objectpegawaifk", insertable = false, updatable = false)
	private Integer pegawaiId;

	@ManyToOne(fetch = LAZY)
	@NotNull(message = "Jabatan tidak boleh kosong")
	@JoinColumn(name = "objectjabatanfk")
	@Caption(value = "Jabatan")
	private Jabatan jabatan;

	@Column(name = "objectjabatanfk", insertable = false, updatable = false)
	private Integer jabatanId;

	@ManyToOne(fetch = LAZY)
	@NotNull(message = "Indikator kinerja detail tidak boleh kosong")
	@JoinColumn(name = "objectindikatordetailfk")
	@Caption(value = "Indikator Kinerja Detail")
	private IndikatorKinerjaDetail indikatorDetail;

	@Column(name = "objectindikatordetailfk", insertable = false, updatable = false)
	private Integer indikatorDetailId;

	@Column(name = "tglhitung")
	@Temporal(TIMESTAMP)
	@Caption(value = "Tanggal Hitung")
	public Date tglHitung;

}
