package com.jasamedika.medifirst2000.entities;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

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

import static javax.persistence.CascadeType.ALL;

@Getter
@Setter
@Entity
@Table(name = "LembarKonsultasi_T")
public class LembarKonsultasi extends BaseTransaction {

	@JsonBackReference
	@OneToOne
	@JoinColumn(name = "ObjectPapRencanaKonsultasiFk")
	@Caption(value = "Object Rencana Konsultasi")
	private PapRencanaKonsultasi papRencanaKonsultasi;

	@Column(name = "ObjectPapRencanaKonsultasiFk", insertable = false, updatable = false)
	private String papRencanaKonsultasiId;

	@ManyToOne
	@JoinColumn(name = "ObjectPasienDaftarFk")
	@Caption(value = "Object PasienDaftar")
	private PasienDaftar pasienDaftar;

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

	@ManyToOne
	@JoinColumn(name = "ObjectPasienFk")
	@Caption(value = "Object Pasien")
	private Pasien pasien;

	@Column(name = "ObjectPasienFk", insertable = false, updatable = false)
	private Integer pasienId;

	@ManyToOne
	@JoinColumn(name = "ObjectRuanganFk")
	@Caption(value = "Object Ruangan")
	private Ruangan ruangan;

	@Column(name = "ObjectRuanganFk", insertable = false, updatable = false)
	private Integer ruanganId;

	@ManyToOne
	@JoinColumn(name = "ObjectDokterFk")
	@Caption(value = "Object Dokter")
	private Pegawai pegawai;

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

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

	@Column(name = "HasilPemeriksaan")
	@Caption(value = "HasilPemeriksaan")
	private String hasilPemeriksaan;

	@Column(name = "Saran")
	@Caption(value = "Saran")
	private String saran;

	@JsonManagedReference
	@OneToOne(cascade = ALL, mappedBy = "lembarKonsultasi")
	private JawabanKonsultasi jawabanKonsultasi;

	@Column(name = "TglInput")
	@Caption(value = "Tanggal Input")
	private Date tglInput;

}
