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.FetchType.LAZY;
import static javax.persistence.GenerationType.SEQUENCE;

/**
 * class JenisKemasan
 * 
 * @author Generator
 */
@Getter
@Setter
@Entity
@Table(name = "JenisKemasan_M")
public class JenisKemasan extends BaseMaster {

	@NotNull(message = "Jenis Kemasan tidak boleh kosong")
	@Column(name = "JenisKemasan", nullable = false, length = 30)
	@Caption(value = "Jenis Kemasan")
	private String jenisKemasan;

	@NotNull(message = "Kd Jenis Kemasan tidak boleh kosong")
	@Column(name = "KdJenisKemasan", nullable = false)
	@Caption(value = "Kode Jenis Kemasan")
	private Byte kdJenisKemasan;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectProdukFk")
	@Caption(value = "Object Produk")
	private Produk produk;

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

	@Column(name = "IsRacikan")
	@Caption(value = "Is Racikan")
	private Boolean isRacikan;

	@NotNull(message = "QJenis Kemasan tidak boleh kosong")
	@Column(name = "QJenisKemasan", nullable = false)
	@Caption(value = "QJenis Kemasan")
	private Byte qJenisKemasan;

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

}