package com.jasamedika.medifirst2000.entities;

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

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

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

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 12/06/2024
 */
@Getter
@Setter
@Entity
@Table(name = "detailpersiapanoperasi_t")
public class DetailPersiapanOperasi extends BaseTransaction implements Serializable {
	private static final long serialVersionUID = -6849730642670346L;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "berkasoperasifk")
	@NotNull(message = "Berkas operasi tidak boleh kosong")
	@Caption(value = "Berkas Operasi")
	private BerkasOperasi berkasOperasi;

	@Column(name = "berkasoperasifk", insertable = false, updatable = false, nullable = false)
	private Long berkasOperasiId;

	@Column(name = "statusberkas", length = 50)
	@Enumerated(STRING)
	private StatusBerkasOperasi statusBerkas;

	@Column(name = "keterangan", length = 500)
	private String keterangan;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "persiapanoperasifk")
	@NotNull(message = "Persiapan operasi tidak boleh kosong")
	@Caption(value = "Persiapan Operasi")
	private PersiapanOperasi persiapanOperasi;

	@Column(name = "persiapanoperasifk", columnDefinition = "CHAR(32)", insertable = false, updatable = false, nullable = false)
	private String persiapanOperasiId;
}
