package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;

import static javax.persistence.EnumType.STRING;
import static javax.persistence.FetchType.LAZY;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 04/03/2024
 */
@Getter
@Setter
@Entity
@Table(name = "monitoring_kinerja_t", schema = "mkko")
public class MonitoringKinerja extends BaseTransaction implements Serializable {
	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "kinerja_fk", nullable = false)
	@NotNull(message = "Kinerja tidak boleh kosong")
	@Caption(value = "Kinerja")
	private KinerjaOperasional kinerja;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "periode_fk", nullable = false, columnDefinition = "bigint")
	@NotNull(message = "Periode monitoring tidak boleh kosong")
	@Caption(value = "Periode Monitoring")
	private PeriodeMonitoring periode;

	@Column(name = "nilai_anggaran", length = 20, columnDefinition = "varchar(20)")
	@Enumerated(STRING)
	@Size(max = 20, message = "Status migrasi maksimal {max} karakter")
	@Caption(value = "Nilai Anggaran")
	private NilaiAnggaran nilaiAnggaran;

	@Column(name = "tahun")
	@Caption(value = "Tahun")
	private Integer tahun;

	@Column(name = "nilai_kinerja", nullable = false, columnDefinition = "numeric(15,2) default 0.00")
	@NotNull(message = "Nilai kinerja tidak boleh kosong")
	private BigDecimal nilaiKinerja;
}
