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.FetchType.LAZY;
import static javax.persistence.GenerationType.SEQUENCE;

/**
 * class JenisDokumen
 * 
 * @author Generator
 */
@Getter
@Setter
@Entity
@Table(name = "JenisDokumen_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class JenisDokumen extends BaseMaster {

	@NotNull(message = "Jenis Dokumen tidak boleh kosong")
	@Column(name = "JenisDokumen", nullable = false, length = 50)
	@Caption(value = "Jenis Dokumen")
	private String jenisDokumen;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectDepartemenFk")
	@Caption(value = "Object Departemen")
	private Departemen departemen;

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

	@NotNull(message = "Kd Jenis Dokumen tidak boleh kosong")
	@Column(name = "KdJenisDokumen", nullable = false)
	@Caption(value = "Kode Jenis Dokumen")
	private short kdJenisDokumen;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectJenisDokumenHeadFk")
	@Caption(value = "Object Jenis Dokumen Head")
	private JenisDokumen jenisDokumenHead;

	@Column(name = "ObjectJenisDokumenHeadFk", insertable = false, updatable = false)
	private Integer jenisDokumenHeadId;

	@NotNull(message = "QJenis Dokumen tidak boleh kosong")
	@Column(name = "QJenisDokumen", nullable = false)
	@Caption(value = "QJenis Dokumen")
	private short qJenisDokumen;

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

}