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.math.BigDecimal;
import java.util.Date;

import static javax.persistence.FetchType.LAZY;

@Getter
@Setter
@Entity
@Table(name = "PelayananPasienDetail_T")
public class PelayananPasienDetail extends MedicalRecordTransaction {

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "Generik")
	@Caption(value = "Generik")
	private Generik generik;

	@Column(name = "Generik", insertable = false, updatable = false)
	private Integer generikId;

	@Caption(value = "statusOrder")
	@Column(name = "statusOrder")
	private Byte statusOrder;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "KomponenHargaFk")
	@NotNull(message = "Struk Order Harus Diisi")
	@Caption(value = "Komponen Harga")
	private KomponenHarga komponenHarga;

	@Caption(value = "Tanggal Pelayanan")
	@Column(name = "TglPelayanan")
	private Date tglPelayanan;

	@Caption(value = "jasa")
	@Column(name = "jasa")
	private Double jasa;

	@Column(name = "KomponenHargaFk", insertable = false, updatable = false)
	private Integer komponenHargaId;

	@Caption(value = "Harga Satuan")
	@Column(name = "hargaSatuan")
	private Double hargaSatuan;

	@Caption(value = "Harga Jual")
	@Column(name = "HargaJual")
	private Double hargaJual;

	@Caption(value = "Nilai Normal")
	@Column(name = "NilaiNormal")
	private Boolean nilaiNormal;

	@Column(columnDefinition = "numeric(6,2)")
	@Caption("Persen Diskon")
	private BigDecimal persenDiskon;

	@Column(columnDefinition = "numeric(6,2)")
	@Caption("Persen Diskon Sayatan")
	private BigDecimal persenDiskonSayatan;

	@Caption(value = "Harga Discount")
	@Column(name = "hargaDiscount")
	private Double hargaDiscount;

	@Caption(value = "Piutang Penjamin")
	@Column(name = "piutangPenjamin")
	private Double piutangPenjamin;

	@Caption(value = "Piutang Rumah Sakit")
	@Column(name = "piutangRumahSakit")
	private Double piutangRumahSakit;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "StrukOrderFk")
	@Caption(value = "Struk Order")
	private StrukOrder strukOrder;

	@Column(name = "StrukOrderFk", columnDefinition = "CHAR(32)", insertable = false, updatable = false)
	private String strukOrderId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "JenisObatFk")
	@Caption(value = "Jenis Obat")
	private JenisObat jenisObat;

	@Column(name = "JenisObatFk", insertable = false, updatable = false)
	private Integer jenisObatId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ProdukFk")
	@NotNull(message = "Produk Harus Diisi")
	@Caption(value = "Produk")
	private Produk produk;

	@Column(name = "ProdukFk", insertable = false, updatable = false)
	private Integer produkId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "PelayananPasien")
	@NotNull(message = "Pelayanan Pasien Tidak boleh Kosong")
	@Caption(value = "PelayananPasien")
	private PelayananPasien pelayananPasien;

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

	@Column(name = "Stock", length = 100)
	@Caption(value = "Stock")
	private Integer stock;

	@NotNull(message = "jumlah Tidak boleh Kosong")
	@Column(name = "Jumlah", nullable = false, length = 100)
	@Caption(value = "Jumlah")
	private Double jumlah;

	@Column(name = "AturanPakai", length = 100)
	@Caption(value = "AturanPakai")
	private String aturanPakai;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "RouteFk")
	@Caption(value = "Route")
	private RouteFarmasi route;

	@Column(name = "RouteFk", insertable = false, updatable = false)
	private Integer routeId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "KeteranganPakaiFk")
	@Caption(value = "Keterangan Pakai")
	private Stigma keteranganPakai;

	@Column(name = "KeteranganPakaiFk", insertable = false, updatable = false)
	private Integer keteranganPakaiId;

	@Column(name = "KeteranganPakai2", length = 100)
	@Caption(value = "KeteranganPakai2")
	private String keteranganPakai2;

	@Column(name = "KeteranganLain", length = 100)
	@Caption(value = "KeteranganLain")
	private String keteranganLain;

	@Caption(value = "hargaNetto")
	@Column(name = "hargaNetto")
	private Double hargaNetto;

	@Caption(value = "NoRecTriger")
	@Column(name = "noRecTriger")
	private String noRecTriger;
}
