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

	@ManyToOne
	@JoinColumn(name = "ObjectDepartemenFk")
	@NotNull(message = "Kd Departemen tidak boleh kosong")
	@Caption(value = "Object Departemen")
	private Departemen departemen;

	@Column(name = "ObjectDepartemenFk", insertable = false, updatable = false)
	private Integer departemenId;

	@NotNull(message = "Kd Lokasi tidak boleh kosong")
	@Column(name = "KdLokasi", nullable = false)
	@Caption(value = "Kode Lokasi")
	private short kdLokasi;

	@ManyToOne
	@JoinColumn(name = "ObjectLokasiHeadFk")
	@Caption(value = "Object Lokasi Head")
	private Lokasi lokasiHead;

	@Column(name = "ObjectLokasiHeadFk", insertable = false, updatable = false, nullable = false)
	private Integer lokasiHeadId;

	@NotNull(message = "Nama Lokasi tidak boleh kosong")
	@Column(name = "NamaLokasi", nullable = false, length = 30)
	@Caption(value = "Nama Lokasi")
	private String namaLokasi;

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

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

}