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 javax.validation.constraints.NotNull;

import static javax.persistence.FetchType.LAZY;
import static javax.persistence.GenerationType.SEQUENCE;

@Getter
@Setter
@Entity
@Table(name = "KomponenIndex_M")
public class KomponenIndex extends BaseMaster {

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectJenisKomponenIndexFk")
	@NotNull(message = "Kd Jenis Komponen Index tidak boleh kosong")
	@Caption(value = "Object Jenis Komponen Index")
	private JenisKomponenIndex jenisKomponenIndex;

	@Column(name = "ObjectJenisKomponenIndexFk", insertable = false, updatable = false)
	private Integer jenisKomponenIndexId;

	@NotNull(message = "Kd Komponen Index tidak boleh kosong")
	@Column(name = "KdKomponenIndex", nullable = false, length = 2)
	@Caption(value = "Kode Komponen Index")
	private String kdKomponenIndex;

	@NotNull(message = "Komponen Index tidak boleh kosong")
	@Column(name = "KomponenIndex", nullable = false, length = 50)
	@Caption(value = "Komponen Index")
	private String komponenIndex;

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

	@NotNull(message = "QKomponen Index tidak boleh kosong")
	@Column(name = "QKomponenIndex", nullable = false)
	@Caption(value = "QKomponen Index")
	private Byte qKomponenIndex;

	@Column(name = "NilaiStandar")
	@Caption(value = "Nilai Standar")
	private Integer nilaiStandar;

	@Column(name = "FactorRate")
	@Caption(value = "Factor Rate")
	private Float factorRate;

	@Column(name = "OperatorFactorRate")
	@Caption(value = "Operator Factor Rate")
	private String operatorFactorRate;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectPendidikanFk")
	@Caption(value = "Kd Pendidikan")
	private Pendidikan pendidikan;

	@Column(name = "ObjectPendidikanFk", insertable = false, updatable = false)
	private Integer pendidikanId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectJabatanFk")
	@Caption(value = "Jabatan")
	private Jabatan jabatan;

	@Column(name = "ObjectJabatanFk", insertable = false, updatable = false)
	private Integer jabatanId;

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

}
