package com.jasamedika.medifirst2000.entities;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 java.util.Date;

import static javax.persistence.FetchType.LAZY;

@Getter
@Setter
@Entity
@Table(name = "IpsrsPeminjamanAlat_T")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class IpsrsPeminjamanAlat extends BaseTransaction {

	@Caption(value = "No Peminjaman")
	@Column(name = "NoPeminjaman", nullable = false)
	private String noPeminjaman;

	@NotNull(message = "Tanggal Peminjaman tidak boleh kososng")
	@Caption(value = "Tanggal Peminjaman")
	@Column(name = "TglPeminjaman", nullable = false)
	private Date tglPeminjaman;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectRuanganPeminjamFk")
	@Caption(value = "RuanganPeminjam")
	private Ruangan ruanganPeminjam;

	@Column(name = "ObjectRuanganPeminjamFk", insertable = false, updatable = false)
	private Integer ruanganPeminjamId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectRuanganAsalFk")
	@Caption(value = "RuanganAsal")
	private Ruangan ruanganAsal;

	@Column(name = "ObjectRuanganAsalFk", insertable = false, updatable = false)
	private Integer ruanganAsalId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectPeminjamFk")
	@Caption(value = "Peminjam")
	private Pegawai peminjam;

	@Column(name = "ObjectPeminjamFk", insertable = false, updatable = false)
	private Integer peminjamId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectRegisterAssetFk")
	@Caption(value = "register aset")
	private RegistrasiAset registrasiAset;

	@Column(name = "ObjectRegisterAssetFk", columnDefinition = "CHAR(32)", insertable = false, updatable = false)
	private String registrasiAsetId;

	@Caption(value = "Jumlah")
	@NotNull(message = "Jumlah tidak boleh kososng")
	@Column(name = "Jumlah", nullable = false)
	private Integer jumlah;

	@NotNull(message = "Tanggal Pengembalian tidak boleh kososng")
	@Caption(value = "Tanggal Pengembalian")
	@Column(name = "TglPengembalian", nullable = false)
	private Date tglPengembalian;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectPetugasFk")
	@Caption(value = "Petugas")
	private Pegawai petugas;

	@Column(name = "ObjectPetugasFk", insertable = false, updatable = false)
	private Integer petugasId;

	@Caption(value = "Status")
	@Column(name = "Status", nullable = false)
	private String status;

}
