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 = "PegawaiStrukturGajiByMaKaPe_M")
public class GajiPerMasaKerjaPendidikan extends BaseMaster {

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

	@ManyToOne(fetch = LAZY)
	@NotNull(message = "Detail Kategory Pegawai tidak boleh kosong")
	@JoinColumn(name = "KdDetailKategoryPegawaiFk", nullable = false)
	@Caption("Detail Kategory Pegawai")
	private DetailKategoryPegawai detailKategoryPegawai;

	@ManyToOne(fetch = LAZY)
	@NotNull(message = "Kode Pendidikan tidak boleh kosong")
	@JoinColumn(name = "KdPendidikanFk", nullable = false)
	@Caption("Pendidikan")
	private Pendidikan pendidikan;

	@ManyToOne(fetch = LAZY)
	@NotNull(message = "Range Masa Kerja tidak boleh kosong")
	@JoinColumn(name = "KdRangeMasaKerjaFk", nullable = false)
	@Caption("Range Masa Kerja")
	private Range range;

	@ManyToOne(fetch = LAZY)
	@NotNull(message = "Komponen Harga tidak boleh kosong")
	@JoinColumn(name = "KdKomponenHargaFk", nullable = false)
	@Caption(value = "Komponen Harga")
	private KomponenHarga komponenHarga;

	@NotNull(message = "Harga Satuan tidak boleh kosong")
	@Column(name = "HargaSatuan", nullable = false)
	@Caption(value = "Harga Satuan")
	private float hargaSatuan;

	@NotNull(message = "Factor Rate tidak boleh kosong")
	@Column(name = "FactorRate", nullable = false)
	@Caption(value = "Factor Rate")
	private long factorRate;

	@NotNull(message = "Operator Factor Rate tidak boleh kosong")
	@Column(name = "OperatorFactorRate", length = 1, nullable = false)
	@Caption(value = "Operator Factor Rate")
	private String operatorFactorRate;

}
