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 BahanProduk
 * 
 * @author Generator
 */
@Getter
@Setter
@Entity
@Table(name = "BahanProduk_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class BahanProduk extends BaseMaster {

	@NotNull(message = "Kd Bahan Produk tidak boleh kosong")
	@Column(name = "KdBahanProduk", nullable = false)
	@Caption(value = "Kode Bahan Produk")
	private Byte kdBahanProduk;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectDepartemenFk")
	@NotNull(message = "Kd Departemen tidak boleh kosong")
	@Caption(value = "Object Departemen")
	private Departemen departemen;

	@Column(name = "ObjectDepartemenFk", insertable = false, updatable = false)
	private Integer departemenId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectKelompokProdukFk")
	@Caption(value = "Object Kelompok Produk")
	private KelompokProduk kelompokProduk;

	@Column(name = "ObjectKelompokProdukFk", insertable = false, updatable = false, nullable = false)
	private Integer kelompokProdukId;

	@NotNull(message = "Nama Bahan Produk tidak boleh kosong")
	@Column(name = "NamaBahanProduk", nullable = false, length = 30)
	@Caption(value = "Nama Bahan Produk")
	private String namaBahanProduk;

	@NotNull(message = "QBahan Produk tidak boleh kosong")
	@Column(name = "QBahanProduk", nullable = false)
	@Caption(value = "QBahan Produk")
	private Byte qBahanProduk;

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

}