package com.jasamedika.medifirst2000.entities;

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 java.util.HashSet;
import java.util.Set;

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

@Getter
@Setter
@Entity
@Table(name = "LaporanUjiHasil_T")
public class LaporanUjiHasil extends BaseTransaction {

	@Column(name = "nomorContoh", columnDefinition = "TEXT")
	@Caption(value = "Nomor contoh")
	private String nomorContoh;

	@Column(name = "contohDari", columnDefinition = "TEXT")
	@Caption(value = "Contoh Dari")
	private String contohDari;

	@Column(name = "uraianContoh", columnDefinition = "TEXT")
	@Caption(value = "uraian Contoh")
	private String uraianContoh;

	@Column(name = "TanggalPenerimaanContoh")
	@Caption(value = "Tanggal penerimaan contoh")
	private Date tanggalPenerimaanContoh;

	@Column(name = "TanggalPengujianContohFrom")
	@Caption(value = "Tanggal penerimaan contoh from")
	private Date tanggalPengujianContohFrom;

	@Column(name = "TanggalPengujianContohTo")
	@Caption(value = "Tanggal penerimaan contoh to")
	private Date tanggalPengujianContohTo;

	@Column(name = "JenisContoh")
	@Caption(value = "jenis contoh")
	private String jenisContoh;

	@Column(name = "TipeLokasi")
	@Caption(value = "tipe lokasi")
	private String tipeLokasi;

	@JsonManagedReference
	@OneToMany(cascade = ALL, fetch = LAZY, mappedBy = "laporanUjiHasil")
	@Caption(value = "map parameter to laporan uji hasil")
	private Set<MapParameterToLaporanUjiHasil> mapParameterToLaporanUjiHasil = new HashSet<>();

	@ManyToOne
	@JoinColumn(name = "ObjectRekananFk")
	@Caption(value = "PT")
	private Rekanan rekanan;

	@Column(name = "ObjectRekananFk", insertable = false, updatable = false)
	private Integer rekananId;

}
