package com.jasamedika.medifirst2000.entities;

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

import javax.persistence.*;
import javax.validation.constraints.NotNull;

@Getter
@Setter
@Entity
@Table(name = "KonversiSatuan_T")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class KonversiSatuan extends BaseTransaction {

	@ManyToOne
	@JoinColumn(name = "ObjekProdukFk", nullable = false)
	@NotNull
	@JsonBackReference
	private Produk produk;

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

	@ManyToOne
	@JoinColumn(name = "SatuanStandar_Asal", nullable = false)
	@NotNull
	@JsonBackReference
	private SatuanStandar satuanStandarAsal;

	@Column(name = "satuanStandar_Asal", insertable = false, updatable = false, nullable = false)
	private Integer satuanStandarAsalId;

	@ManyToOne
	@JoinColumn(name = "SatuanStandar_Tujuan", nullable = false)
	@NotNull
	@JsonBackReference
	private SatuanStandar satuanStandarTujuan;

	@Column(name = "SatuanStandar_Tujuan", insertable = false, updatable = false, nullable = false)
	private Integer satuanStandarTujuanId;

	@Column(name = "NilaiKonversi", nullable = false)
	@NotNull
	private Double nilaiKonversi;

}
