package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.NotBlank;

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

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

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 07/11/2023
 */
@Getter
@Setter
@Entity
@Table(name = "rekaplogbookdokter_t")
public class RekapLogbookDokter extends BaseTransaction {
	private static final long serialVersionUID = -3729381313810208723L;

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

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

	@Column(length = 16, nullable = false)
	@NotBlank(message = "Jenis logbook tidak boleh kosong")
	@Size(max = 16, message = "Jenis logbook maksimal {max} karaketer")
	private String jenisLogbook;

	@Column(length = 16)
	@Size(max = 16, message = "Jenis ruangan maksimal {max} karaketer")
	private String jenisRuangan;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "kelompokpasienfk")
	@NotNull(message = "Kelompok pasien tidak boleh kosong")
	@Caption(value = "Kelompok Pasien")
	private KelompokPasien kelompokPasien;

	@Column(name = "kelompokpasienfk", insertable = false, updatable = false, nullable = false)
	private Integer kelompokPasienId;

	@Column(length = 8)
	@Size(max = 8, message = "Bulan pulang ibu maksimal {max} karaketer")
	private String bulanPulangIbu;

	@Column(nullable = false)
	@NotNull(message = "Bulan logbook tidak boleh kosong")
	@Temporal(DATE)
	private Date bulan;

	@Column(columnDefinition = "float default 0")
	private Double jumlah;

	@Column(columnDefinition = "float default 0")
	private Double capaian;
}
