package com.jasamedika.medifirst2000.entities;

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.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;

@Entity
@Table(name = "Kelas_M")
public class Kelas extends BaseMaster {

	@NotNull(message = "Nama Kelas tidak boleh kosong")
	@Column(name = "NamaKelas", nullable = false, length = 30)
	@Caption(value = "Nama Kelas")
	private String namaKelas;

	@NotNull(message = "No Urut tidak boleh kosong")
	@Column(name = "NoUrut", nullable = false)
	@Caption(value = "No Urut")
	private Byte noUrut;

	@NotNull(message = "QKelas tidak boleh kosong")
	@Column(name = "QKelas", nullable = false)
	@Caption(value = "QKelas")
	private Byte qKelas;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="ObjectKelasHeadFk")
	private Kelas kelasHead;
	
	@Column(name="ObjectKelasHeadFk", nullable=true, insertable=false, updatable=false)
	private Integer kelasHeadId;

	public String getNamaKelas() {
		return namaKelas;
	}

	public void setNamaKelas(String namaKelas) {
		this.namaKelas = namaKelas;
	}

	public Byte getNoUrut() {
		return noUrut;
	}

	public void setNoUrut(Byte noUrut) {
		this.noUrut = noUrut;
	}

	public Byte getqKelas() {
		return qKelas;
	}

	public void setqKelas(Byte qKelas) {
		this.qKelas = qKelas;
	}

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

	public Integer getId() {

		return id;
	}

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

	public Kelas getKelasHead() {
		return kelasHead;
	}

	public void setKelasHead(Kelas kelasHead) {
		this.kelasHead = kelasHead;
	}

	public Integer getKelasHeadId() {
		return kelasHeadId;
	}

	public void setKelasHeadId(Integer kelasHeadId) {
		this.kelasHeadId = kelasHeadId;
	}
}