package com.jasamedika.medifirst2000.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;

@Entity
@Table(name = "Kamar_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class Kamar extends BaseMaster {

	public Kamar(short kdKamar, String namaKamar, Integer id) {
		super();
		this.kdKamar = kdKamar;
		this.namaKamar = namaKamar;
		this.id = id;
	}

	public Kamar() {}
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "public.kamar_m_id_seq")
	@javax.persistence.SequenceGenerator(name = "public.kamar_m_id_seq", sequenceName = "public.kamar_m_id_seq", allocationSize = 1)
	@Column(name = "id")
	protected Integer id;

	@NotNull(message = "Kd Kamar tidak boleh kosong")
	@Column(name = "KdKamar", nullable = false)
	@Caption(value = "Kode Kamar")
	private short kdKamar;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectKelasFk")
	@NotNull(message = "Kd Kelas tidak boleh kosong")
	@Caption(value = "Object Kelas")
	private Kelas kelas;

	@Column(name = "ObjectKelasFk", insertable = false, updatable = false)
	private Integer kelasId;

	@ManyToOne(fetch = FetchType.LAZY)
	@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;

	@Column(name = "Keterangan", nullable = true, length = 500)
	@Caption(value = "Keterangan")
	private String keterangan;
	
	@Column(name = "tglUpdate", nullable = true)
	@Caption(value = "tglUpdate")
	private Date tglUpdate;

	@Column(name = "jumlaKamarIsi", nullable = true, length = 500)
	@Caption(value = "Jumla Kamar Isi")
	private Integer jumlaKamarIsi;

	@Column(name = "jumlaKamarKosong", nullable = true, length = 500)
	@Caption(value = "Jumla Kamar Kosong")
	private Integer jumlaKamarKosong;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectRuangPerawatanKemenkesFk",nullable = true)
	@Caption(value = "RuangPerawatanKemenkes")
	private RuangPerawatanKemenkes ruangPerawatanKemenkes;
	
	@Column(name = "ObjectRuangPerawatanKemenkesFk", insertable = false, updatable = false)
	private Integer ruangPerawatanKemenkesId;

	@NotNull(message = "Nama Kamar tidak boleh kosong")
	@Column(name = "NamaKamar", nullable = false, length = 20)
	@Caption(value = "Nama Kamar")
	private String namaKamar;

	@NotNull(message = "QKamar tidak boleh kosong")
	@Column(name = "QKamar", nullable = false)
	@Caption(value = "QKamar")
	private short qKamar;

	@NotNull(message = "Qty Bed tidak boleh kosong")
	@Column(name = "QtyBed", nullable = false)
	@Caption(value = "Qty Bed")
	private Byte qtyBed;
	
	@ManyToOne
	@JoinColumn(name = "ProdukFk")
	@NotNull(message = "Produk Harus Diisi")
	@Caption(value = "Produk")
	private Produk produk;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public short getKdKamar() {
		return kdKamar;
	}

	public void setKdKamar(short kdKamar) {
		this.kdKamar = kdKamar;
	}

	public Kelas getKelas() {
		return kelas;
	}

	public void setKelas(Kelas kelas) {
		this.kelas = kelas;
	}

	public Integer getKelasId() {
		return kelasId;
	}

	public void setKelasId(Integer kelasId) {
		this.kelasId = kelasId;
	}

	public Ruangan getRuangan() {
		return ruangan;
	}

	public void setRuangan(Ruangan ruangan) {
		this.ruangan = ruangan;
	}

	public Integer getRuanganId() {
		return ruanganId;
	}

	public void setRuanganId(Integer ruanganId) {
		this.ruanganId = ruanganId;
	}

	public String getKeterangan() {
		return keterangan;
	}

	public void setKeterangan(String keterangan) {
		this.keterangan = keterangan;
	}

	public Date getTglUpdate() {
		return tglUpdate;
	}

	public void setTglUpdate(Date tglUpdate) {
		this.tglUpdate = tglUpdate;
	}

	public Integer getJumlaKamarIsi() {
		return jumlaKamarIsi;
	}

	public void setJumlaKamarIsi(Integer jumlaKamarIsi) {
		this.jumlaKamarIsi = jumlaKamarIsi;
	}

	public Integer getJumlaKamarKosong() {
		return jumlaKamarKosong;
	}

	public void setJumlaKamarKosong(Integer jumlaKamarKosong) {
		this.jumlaKamarKosong = jumlaKamarKosong;
	}

	public RuangPerawatanKemenkes getRuangPerawatanKemenkes() {
		return ruangPerawatanKemenkes;
	}

	public void setRuangPerawatanKemenkes(RuangPerawatanKemenkes ruangPerawatanKemenkes) {
		this.ruangPerawatanKemenkes = ruangPerawatanKemenkes;
	}

	public Integer getRuangPerawatanKemenkesId() {
		return ruangPerawatanKemenkesId;
	}

	public void setRuangPerawatanKemenkesId(Integer ruangPerawatanKemenkesId) {
		this.ruangPerawatanKemenkesId = ruangPerawatanKemenkesId;
	}

	public String getNamaKamar() {
		return namaKamar;
	}

	public void setNamaKamar(String namaKamar) {
		this.namaKamar = namaKamar;
	}

	public short getqKamar() {
		return qKamar;
	}

	public void setqKamar(short qKamar) {
		this.qKamar = qKamar;
	}

	public Byte getQtyBed() {
		return qtyBed;
	}

	public void setQtyBed(Byte qtyBed) {
		this.qtyBed = qtyBed;
	}

	public Produk getProduk() {
		return produk;
	}

	public void setProduk(Produk produk) {
		this.produk = produk;
	}

}