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;

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

	@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)
	private Integer produkId;

	@ManyToOne
	@JoinColumn(name = "ObjectRuanganFk")
	@NotNull(message = "Kd Ruangan tidak boleh kosong")
	@Caption(value = "Object Ruangan")
	private Ruangan ruangan;

	@Column(name = "ObjectRuanganFk", insertable = false, updatable = false, nullable = false)
	private Integer ruanganId;

	@NotNull(message = "Status tidak boleh kosong")
	@Column(name = "Status", nullable = false, length = 2)
	@Caption(value = "Status")
	private String status;

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

}