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 = "MapProdukMenuToBahan_M")
public class MapProdukMenuToBahan extends BaseMaster {

	@ManyToOne
	@JoinColumn(name = "ObjectMenuProdukFK")
	@NotNull(message = "Menu Produk tidak boleh kosong")
	@Caption(value = "Menu Produk")
	private Produk menuProduk;

	@Column(name = "ObjectMenuProdukFK", insertable = false, updatable = false, nullable = false)
	private Integer menuProdukId;

	@ManyToOne
	@JoinColumn(name = "ObjectBahanProdukFK")
	@NotNull(message = "Bahan Produk tidak boleh kosong")
	@Caption(value = "Bahan Produk")
	private Produk bahanProduk;

	@Column(name = "ObjectBahanProdukFK", insertable = false, updatable = false, nullable = false)
	private Integer bahanProdukId;

	@Column(name = "standarPorsi")
	@Caption(value = "Standar Porsi")
	private Double standarPorsi;

	@ManyToOne
	@JoinColumn(name = "ObjectSatuanStandarFK")
	@NotNull(message = "Satuan Standar tidak boleh kosong")
	@Caption(value = "Satuan Standar")
	private SatuanStandar satuanStandar;

	@Column(name = "ObjectSatuanStandarFK", insertable = false, updatable = false, nullable = false)
	private Integer satuanStandarId;

	@Column(name = "keterangan")
	@Caption(value = "Keterangan")
	private String keterangan;

	@ManyToOne
	@JoinColumn(name = "ObjectKelasFK")
	@Caption(value = "kelas")
	private Kelas kelas;

	@Column(name = "ObjectKelasFK", insertable = false, updatable = false)
	private Integer kelasId;

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

}