package com.jasamedika.medifirst2000.entities;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.jasamedika.medifirst2000.helper.Caption;import org.hibernate.envers.Audited;
import com.jasamedika.medifirst2000.vo.PelayananTpnVO;

@Entity //@Audited
@Table(name="PelayananProduksi_T")
public class PelayananProduksi extends MedicalRecordTransaction{
	
	
	@Column(name = "noProduksi", nullable = true, length = 100)
	@Caption(value = "noProduksi")
	private String noProduksi;
	
	@NotNull(message = "expired tidak boleh kosong")
	@Column(name = "expired", nullable = false)
	@Caption(value = "expired")
	private Date tglExpired;

	@ManyToOne
	@JoinColumn(name = "ObjectStorageFk")
	@NotNull(message = "Storage tidak boleh kosong")
	private Storage storage;
	
	@Column(name = "ObjectStorageFk", insertable = false, updatable = false, nullable = false)
	private Integer storageId;
	
	@NotNull(message="volume tidak boleh kosong")
	@Column(name = "volume", nullable = true, length = 100)
	@Caption(value = "volume")
	private String volume;
	
	
	@Column(name = "osm", nullable = true, length = 100)
	@Caption(value = "osm")
	private String osm;
	
	@NotNull(message = "Tanggal tidak boleh kosong")
	@Column(name = "tanggal", nullable = false)
	@Caption(value = "Tanggal")
	private Date tanggal;
	
	@NotNull(message="unitCost tidak boleh kosong")
	@Column(name = "unitCost", nullable = true, length = 100)
	@Caption(value = "unitCost")
	private String unitCost;
	
	@NotNull(message="Jasa tidak boleh kosong")
	@Column(name = "Jasa", nullable = true, length = 100)
	@Caption(value = "Jasa")
	private String jasa;

//	@JsonBackReference
//	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "pelayananProduksi")
//	@Caption(value = "pelayananTpnSet")
//	private List<PelayananTpn> pelayananTpnSet=new ArrayList<PelayananTpn>();	
	
	//@JsonManagedReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "pelayananAdmixture")
	@Caption(value = "pelayananAdmixture")
	private Set<ProduksiDetail> pelayananAdmixture=new HashSet<ProduksiDetail>();
	
	//@JsonManagedReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "pelayananCytotoxic")
	@Caption(value = "pelayananCytotoxic")
	private Set<ProduksiDetail> pelayananCytotoxic=new HashSet<ProduksiDetail>();
	
	@JsonManagedReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "pelayananProduksi")
	@Caption(value = "pelayananTpnSet")
	private Set<PelayananTpn> pelayananTpnSet=new HashSet<PelayananTpn>();	


	public String getNoProduksi() {
		return noProduksi;
	}

	public void setNoProduksi(String noProduksi) {
		this.noProduksi = noProduksi;
	}

	public Date getTglExpired() {
		return tglExpired;
	}

	public void setTglExpired(Date tglExpired) {
		this.tglExpired = tglExpired;
	}

	public Storage getStorage() {
		return storage;
	}

	public void setStorage(Storage storage) {
		this.storage = storage;
	}

	public String getVolume() {
		return volume;
	}

	public void setVolume(String volume) {
		this.volume = volume;
	}

	public String getOsm() {
		return osm;
	}

	public void setOsm(String osm) {
		this.osm = osm;
	}

	public Date getTanggal() {
		return tanggal;
	}

	public void setTanggal(Date tanggal) {
		this.tanggal = tanggal;
	}

	public String getUnitCost() {
		return unitCost;
	}

	public void setUnitCost(String unitCost) {
		this.unitCost = unitCost;
	}

	public String getJasa() {
		return jasa;
	}

	public void setJasa(String jasa) {
		this.jasa = jasa;
	}

	public Integer getStorageId() {
		return storageId;
	}

	public void setStorageId(Integer storageId) {
		this.storageId = storageId;
	}

	public Set<ProduksiDetail> getPelayananAdmixture() {
		return pelayananAdmixture;
	}

	public void setPelayananAdmixture(Set<ProduksiDetail> pelayananAdmixture) {
		this.pelayananAdmixture = pelayananAdmixture;
	}

	public Set<ProduksiDetail> getPelayananCytotoxic() {
		return pelayananCytotoxic;
	}
		

	public void setPelayananCytotoxic(Set<ProduksiDetail> pelayananCytotoxic) {
		this.pelayananCytotoxic = pelayananCytotoxic;

}

	public Set<PelayananTpn> getPelayananTpnSet() {
		return pelayananTpnSet;
	}

	public void setPelayananTpnSet(Set<PelayananTpn> pelayananTpnSet) {
		this.pelayananTpnSet = pelayananTpnSet;
	}
	}
