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

@Getter
@Setter
@Entity
@Table(name = "Asal_M")
public class Asal extends BaseMaster {

	@Column(name = "kdAsal", nullable = false)
	@Caption(value = "kdAsal")
	private Byte kdAsal;

	@Column(name = "namaAsal", nullable = false)
	@Caption(value = "namaAsal")
	private String namaAsal;

	@ManyToOne
	@JoinColumn(name = "asalHeadFk")
	@Caption(value = "asalHeadFk")
	private Asal asalHead;

	@Column(name = "asalHeadFk", insertable = false, updatable = false)
	private Integer asalHeadId;

	@ManyToOne
	@JoinColumn(name = "asalAsalFk")
	@Caption(value = "asalAsalFk")
	private Asal asalAsal;

	@Column(name = "asalAsalFk", insertable = false, updatable = false, nullable = false)
	private Integer asalAsalId;

	@ManyToOne
	@JoinColumn(name = "departemenFk")
	@Caption(value = "departemenFk")
	private Departemen departemen;

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

	@Column(name = "qAsal", nullable = false)
	@Caption(value = "qAsal")
	private Byte qAsal;

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

}
