package com.jasamedika.medifirst2000.entities;

import java.text.DecimalFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
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.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;import org.hibernate.envers.Audited;
import com.jasamedika.medifirst2000.vo.PelayananProduksiVO;

@Entity //@Audited
@Table(name = "ProduksiDetail_T")
public class ProduksiDetail extends BaseTransaction{
	
	//@JsonManagedReference
	@ManyToOne
	@JoinColumn(name = "ObjectPelayananAdmixtureFk")
	//@NotNull(message = "PelayananAdmixture tidak boleh kosong")
	private PelayananProduksi pelayananAdmixture;
	
	@Column(name = "ObjectPelayananAdmixtureFk", columnDefinition = "CHAR(32)", insertable = false, updatable = false)
	private String pelayananAdmixtureId;
	
	@ManyToOne
	@JoinColumn(name = "ObjectPelayananCytotoxicFk")
	private PelayananProduksi pelayananCytotoxic;
	
	@Column(name = "ObjectPelayananCytotoxicFk", columnDefinition = "CHAR(32)", insertable = false, updatable = false)
	private String pelayananCytotoxicId;
	
	@Caption(value="Kode Barang")
	@Column(name = "KdBarang")
	private String kdBarang;
	
	@Caption(value="Nama Barang")
	@Column(name = "namaBarang")
	private String namaBarang;
	
	@Caption(value="Satuan")
	@Column(name = "satuan")
	private String satuan;
	
	@Caption(value="Quantity")
	@Column(name = "Quantity")
	private Integer qty;
	
	@Caption(value="Harga")
	@Column(name = "harga")
	private Double harga;
	
	@Caption(value="Sub Total")
	@Column(name = "SubTotal")
	private Double subTotal;	
	
	@JsonManagedReference
	@ManyToOne
	@JoinColumn(name = "ObjectProduksiNonSterilFk")
	@Caption("Produksi Non Steril")
	private ProduksiNonSteril produksiNonSteril;
	
	@Column(name = "ObjectProduksiNonSterilFk", columnDefinition = "CHAR(32)", insertable = false, updatable = false, nullable = true)
	private String produksiNonSterilId;
	
	@JsonBackReference
	@ManyToOne
	@JoinColumn(name = "ObjectRefackingFk")
	@Caption("Refacking")
	private Refacking refacking;
	
	@Column(name = "ObjectRefackingFk", columnDefinition = "CHAR(32)", insertable = false, updatable = false, nullable = true)
	private String refackingId;

	public ProduksiNonSteril getProduksiNonSteril() {
		return produksiNonSteril;
	}

	public void setProduksiNonSteril(ProduksiNonSteril produksiNonSteril) {
		this.produksiNonSteril = produksiNonSteril;
	}
	
	public PelayananProduksi getPelayananAdmixture() {
		return pelayananAdmixture;
	}

	public void setPelayananAdmixture(PelayananProduksi pelayananAdmixture) {
		this.pelayananAdmixture = pelayananAdmixture;
	}	

	public String getKdBarang() {
		return kdBarang;
	}

	public void setKdBarang(String kdBarang) {
		this.kdBarang = kdBarang;
	}

	public String getNamaBarang() {
		return namaBarang;
	}

	public void setNamaBarang(String namaBarang) {
		this.namaBarang = namaBarang;
	}

	public String getSatuan() {
		return satuan;
	}

	public void setSatuan(String satuan) {
		this.satuan = satuan;
	}

	public Integer getQty() {
		return qty;
	}

	public void setQty(Integer qty) {
		this.qty = qty;
	}

	public Double getHarga() {
		return harga;
	}

	public void setHarga(Double harga) {
		this.harga = harga;
	}

	public Double getSubTotal() {
		return subTotal;
	}

	public void setSubTotal(Double subTotal) {
		this.subTotal = subTotal;
	}

	public String getPelayananAdmixtureId() {
		return pelayananAdmixtureId;
	}

	public void setPelayananAdmixtureId(String pelayananAdmixtureId) {
		this.pelayananAdmixtureId = pelayananAdmixtureId;
	}

	public PelayananProduksi getPelayananCytotoxic() {
		return pelayananCytotoxic;
	}

	public void setPelayananCytotoxic(PelayananProduksi pelayananCytotoxic) {
		this.pelayananCytotoxic = pelayananCytotoxic;
	}

	public String getPelayananCytotoxicId() {
		return pelayananCytotoxicId;
	}

	public void setPelayananCytotoxicId(String pelayananCytotoxicId) {
		this.pelayananCytotoxicId = pelayananCytotoxicId;
	}

	public Refacking getRefacking() {
		return refacking;
	}

	public void setRefacking(Refacking refacking) {
		this.refacking = refacking;
	}	

}
