package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

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

import static javax.persistence.GenerationType.SEQUENCE;

@Getter
@Setter
@Entity
@Table(name = "mapgeneriktoproduk_m")
public class MapGenerikToProduk extends BaseMaster {

	@ManyToOne
	@JoinColumn(name = "ObjectGenerikFk")
	@NotNull(message = "Generik tidak boleh kosong")
	@Caption(value = "Object Generik")
	private Generik generik;

	@Column(name = "ObjectGenerikFk", insertable = false, updatable = false, nullable = false)
	private Integer generikId;

	@ManyToOne
	@JoinColumn(name = "ObjectProdukFk")
	@NotNull(message = "Produk tidak boleh kosong")
	@Caption(value = "Object Produk")
	private Produk produk;

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

	@ManyToOne
	@JoinColumn(name = "ObjectSatuanDosisFk")
	@NotNull(message = "SatuanDosis tidak boleh kosong")
	@Caption(value = "Object SatuanDosis")
	private SatuanStandar satuanDosis;

	@Column(name = "ObjectSatuanDosisFk", insertable = false, updatable = false, nullable = false)
	private Integer satuanDosisId;

	@ManyToOne
	@JoinColumn(name = "ObjectSatuanSediaanFk")
	@NotNull(message = "Satuan Sediaan tidak boleh kosong")
	@Caption(value = "Object Satuan Sediaan")
	private Sediaan satuanSediaan;

	@Column(name = "ObjectSatuanSediaanFk", insertable = false, updatable = false, nullable = false)
	private Integer satuanSediaanId;

	@ManyToOne
	@JoinColumn(name = "ObjectSatuanVolumeFk")
	@NotNull(message = "Satuan Volume tidak boleh kosong")
	@Caption(value = "Object Satuan Volume")
	private SatuanStandar satuanVolume;

	@Column(name = "ObjectSatuanVolumeFk", insertable = false, updatable = false, nullable = false)
	private Integer satuanVolumeId;

	@Column(name = "kekuatanDosis")
	@Caption(value = "Kekuatan Dosis")
	private Double kekuatanDosis;

	@Column(name = "volume")
	@Caption(value = "Volume")
	private Double volume;

	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "public.mapgeneriktoproduk_m_id_seq")
	@SequenceGenerator(name = "public.mapgeneriktoproduk_m_id_seq", sequenceName = "public.mapgeneriktoproduk_m_id_seq", allocationSize = 1)
	@Column(name = "id")
	protected Integer id;

}