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

	@NotNull(message = "Kd Bahan Sample tidak boleh kosong")
	@Column(name = "KdBahanSample", nullable = false, length = 2)
	@Caption(value = "Kode Bahan Sample")
	private String kdBahanSample;

	@ManyToOne
	@JoinColumn(name = "ObjectSatuanKecilFk")
	@Caption(value = "Object Satuan Kecil")
	private SatuanKecil satuanKecil;

	@Column(name = "ObjectSatuanKecilFk", insertable = false, updatable = false, nullable = false)
	private Integer satuanKecilId;

	@NotNull(message = "Nama Bahan Sample tidak boleh kosong")
	@Column(name = "NamaBahanSample", nullable = false, length = 50)
	@Caption(value = "Nama Bahan Sample")
	private String namaBahanSample;

	@NotNull(message = "QBahan Sample tidak boleh kosong")
	@Column(name = "QBahanSample", nullable = false)
	@Caption(value = "QBahan Sample")
	private short qBahanSample;

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

}