package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.NotBlank;

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

import static javax.persistence.FetchType.LAZY;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 04/03/2024
 */
@Getter
@Setter
@Entity
@Table(name = "kinerja_operasional_m", schema = "mkko")
public class KinerjaOperasional extends BaseTransaction implements Serializable {

	@Column(name = "urutan", length = 20, nullable = false)
	@NotBlank(message = "Urutan tidak boleh kosong")
	@Size(max = 20, message = "Urutan maksimal {max} karakter")
	@Caption("Urutan")
	private String urutan;

	@Column(name = "fungsi_urutan", length = 50, nullable = false)
	@NotBlank(message = "Fungsi urutan tidak boleh kosong")
	@Size(max = 50, message = "Fungsi urutan maksimal {max} karakter")
	@Caption("Fungsi Urutan")
	private String fungsiUrutan;

	@Column(name = "nama_kinerja", length = 150, nullable = false)
	@NotBlank(message = "Nama kinerja tidak boleh kosong")
	@Size(max = 150, message = "Nama kinerja maksimal {max} karakter")
	@Caption("Nama Kinerja")
	private String namaKinerja;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "satuan_kinerja_fk", nullable = false, columnDefinition = "bigint")
	@NotNull(message = "Satuan kinerja tidak boleh kosong")
	@Caption(value = "Satuan Kinerja")
	private SatuanKinerja satuanKinerja;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "kinerja_head_fk")
	@Caption(value = "Kinerja Head")
	private KinerjaOperasional kinerjaHead;

}
