package com.jasamedika.medifirst2000.entities;

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

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.HashSet;
import java.util.Set;

import static javax.persistence.CascadeType.ALL;
import static javax.persistence.FetchType.LAZY;

/**
 * class HasilPemeriksaan
 * 
 * @author Generator
 */
@Getter
@Setter
@Entity
@Table(name = "HasilPemeriksaan_T")
public class HasilPemeriksaan extends BaseTransaction {

	@Column(name = "statusVerifikasi", length = 500)
	@Caption(value = "statusVerifikasi")
	private Byte statusVerifikasi;

	@JsonBackReference
	@OneToMany(cascade = ALL, fetch = LAZY, mappedBy = "hasilPemeriksaan")
	private Set<HasilPemeriksaanDuplo> hasilPemeriksaanDuploSet = new HashSet<>();

	@Column(name = "nilaiNormal", length = 500)
	@Caption(value = "Nilai Normal")
	private String nilaiNormal;

	@Column(name = "Koment", length = 500)
	@Caption(value = "Koment")
	private String comment;

	@Column(name = "Expertise", length = 500)
	@Caption(value = "Expertise")
	private String expertise;

	@Column(name = "Klinis", length = 500)
	@Caption(value = "Klinis")
	private String klinis;

	@ManyToOne
	@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
	@JoinColumn(name = "StrukHasilFk")
	@NotNull(message = "Struk Hasil Harus Diisi")
	@Caption(value = "Struk Hasil")
	private StrukHasilPemeriksaan strukHasilPemeriksaan;

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

	@ManyToOne
	@JoinColumn(name = "DetailFk")
	@Caption(value = "Detail")
	private ProdukDetailLaboratorium detail;

	@Column(name = "DetailFk", insertable = false, updatable = false)
	private Integer detailId;

	@Column(name = "Hasil", nullable = false, length = 100)
	@Caption(value = "Hasil")
	private String hasil;

	@Column(name = "Satuan", length = 30)
	@Caption(value = "Satuan")
	private String satuan;

	@Column(name = "Urutan", length = 30)
	@Caption(value = "Urutan")
	private String urutan;

	@Column(name = "Flag", length = 20)
	@Caption(value = "Flag")
	private String flag;

}