package com.jasamedika.medifirst2000.entities;

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

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

import static javax.persistence.FetchType.LAZY;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 21/12/2023
 */
@Getter
@Setter
@Entity
@Table(name = "dokterrawatbersama_t")
public class DokterRawatBersama implements Serializable {

	private static final long serialVersionUID = 6332383431538705253L;

	@EmbeddedId
	private DokterRawatBersamaId id;

	@Column(nullable = false)
	@NotNull(message = "Tanggal awal tidak boleh kosong")
	private Date tanggalAwal;

	private Date tanggalAkhir;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "noregistrasifk", nullable = false)
	@NotNull(message = "No Registrasi Harus Diisi")
	@Caption(value = "No Registrasi")
	private AntrianPasienDiPeriksa detailRegistrasi;

	@Column(name = "noregistrasifk", columnDefinition = "CHAR(32)", nullable = false, insertable = false, updatable = false)
	private String detailRegistrasiId;

}
