package com.jasamedika.medifirst2000.entities;

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

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

import static javax.persistence.FetchType.LAZY;
import static javax.persistence.GenerationType.SEQUENCE;
import static javax.persistence.TemporalType.TIMESTAMP;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 16/11/2023
 */
@Getter
@Setter
@Entity
@Table(name = "document_vedika_tb")
public class DokumenVedika implements Serializable {

	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "gen_document_vedika_tb_id_seq")
	@SequenceGenerator(name = "gen_document_vedika_tb_id_seq", sequenceName = "public.document_vedika_tb_id_seq", allocationSize = 1)
	@Column(name = "id", columnDefinition = "serial4 default nextval('document_vedika_tb_id_seq'::regclass)")
	protected Integer id;

	@Column(name = "statusenabled")
	@Caption(value = "Status Enabled")
	private Boolean statusEnabled;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "pasiendaftar_t_norec")
	@Caption(value = "Pasien Daftar")
	private PasienDaftar pasienDaftar;

	@Column(name = "pasiendaftar_t_norec", insertable = false, updatable = false)
	private String pasienDaftarId;

	@Column(name = "nam_file", length = 500)
	@Caption(value = "Nama File")
	private String namaFile;

	@Column(name = "url")
	@Caption(value = "URL")
	private String url;

	@Column(name = "deskripsi")
	@Caption(value = "Deskripsi")
	private String deskripsi;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "jenis_berkas_id")
	@Caption(value = "Jenis Berkas")
	private JenisBerkas jenisBerkas;

	@Column(name = "jenis_berkas_id", insertable = false, updatable = false)
	private Integer jenisBerkasId;

	@Column(name = "no_mr")
	@Caption(value = "No Rekam Medis")
	private String pasienNoMr;

	@Column(name = "date_insert")
	@Temporal(TIMESTAMP)
	@Caption(value = "Tanggal Dibuat")
	private Date tglDibuat;

	@Column(name = "id_user", insertable = false, updatable = false)
	@Caption(value = "ID User")
	private Integer userId;

	@Column(name = "log_create_at")
	@Temporal(TIMESTAMP)
	@Caption(value = "Tanggal Log Dibuat")
	private Date logCreateAt;

}
