package com.jasamedika.medifirst2000.entities;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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;

/**
 * class MapPaketToProduk
 * 
 * @author Generator
 */
@Getter
@Setter
@Entity
@Table(name = "MapPaketToProduk_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class MapPaketToProduk extends BaseMaster {

	@ManyToOne
	@JoinColumn(name = "ObjectPaketFk")
	@NotNull(message = "Kd Paket tidak boleh kosong")
	@Caption(value = "Object Paket")
	private Paket paket;

	@Column(name = "ObjectPaketFk", insertable = false, updatable = false)
	private Integer paketId;

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

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

	@Column(name = "QtyProduk")
	@Caption(value = "Qty Produk")
	private Double qtyProduk;

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

	@Column(name = "ObjectSatuanFk", insertable = false, updatable = false, nullable = false)
	private Integer satuanId;

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

}