package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.enums.JenisLog;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.*;

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

import static javax.persistence.EnumType.STRING;
import static javax.persistence.TemporalType.TIMESTAMP;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 31/10/2024
 */

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
@Table(name = "sdm_logbookkinerjadetaillog_t")
public class LogbookKinerjaDetailLog extends BaseTransaction implements Serializable {

	@OneToOne
	@MapsId
	@JoinColumn(name = "norec", columnDefinition = "CHAR(32)")
	@NotNull(message = "Logbook tidak boleh kosong")
	@Caption(value = "Logbook Kinerja")
	private LogbookKinerjaDetail catatanKinerja;

	@Column(length = 30, nullable = false)
	@Enumerated(STRING)
	@NotNull(message = "Jenis log tidak boleh kosong")
	private JenisLog jenisLog;

	@Column(length = 300)
	@Size(max = 300, message = "Keterangan maksimal {max} karakter")
	@Caption(value = "Keterangan")
	private String keterangan;

	@Temporal(TIMESTAMP)
	private Date tanggalDibuat;

	@ManyToOne
	@NotNull(message = "Pegawai tidak boleh kosong")
	@JoinColumn(name = "objectpegawaifk", nullable = false)
	@Caption(value = "Pegawai")
	private Pegawai pegawai;

}
