package com.jasamedika.medifirst2000.entities;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

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

	@Caption(value = "No Planning")
	@Column(name = "NoPlanning", length = 15)
	private String noPlanning;

	@ManyToOne(fetch = FetchType.LAZY)
	@Caption(value = "Object Pegawai")
	@JoinColumn(name = "ObjectPegawaiFk")
	private Pegawai pegawai;

	@Column(name = "ObjectPegawaiFk", insertable = false, updatable = false)
	private Integer pegawaiId;

	@ManyToOne(fetch = FetchType.LAZY)
	@Caption(value = "Object Status Pegawai Plan")
	@JoinColumn(name = "ObjectStatusPegawaiPlanFk")
	private StatusPegawai statusPegawaiPlan;

	@Column(name = "ObjectStatusPegawaiPlanFk", insertable = false, updatable = false)
	private Integer statusPegawaiPlanId;

	@JsonBackReference
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "planningPegawaiStatus", orphanRemoval = true)
	private Set<ListTanggalCuti> listTanggal = new HashSet<>();

	@ManyToOne(fetch = FetchType.LAZY)
	@Caption(value = "Object Departemen")
	@JoinColumn(name = "ObjectDepartemenFk")
	private Departemen departemen;

	@Column(name = "ObjectDepartemenFk", insertable = false, updatable = false)
	private Integer departemenId;

	@Caption(value = "Deskripsi Status Pegawai Plan")
	@Column(name = "DeskripsiStatusPegawaiPlan", length = 1000)
	private String deskripsiStatusPegawaiPlan;

	@Caption(value = "Keterangan Lainya Plan")
	@Column(name = "KeteranganLainyaPlan", length = 1000)
	private String keteranganLainyaPlan;

	@ManyToOne(fetch = FetchType.LAZY)
	@Caption(value = "Object No SK")
	@JoinColumn(name = "ObjectNoSkFk")
	private SuratKeputusan noSk;

	@Column(name = "ObjectNoSkFk", insertable = false, updatable = false)
	private Integer noSkId;

	@ManyToOne(fetch = FetchType.LAZY)
	@Caption(value = "Object Status Pegawai Exec")
	@JoinColumn(name = "ObjectStatusPegawaiExecFk")
	private StatusPegawai statusPegawaiExec;

	@Column(name = "ObjectStatusPegawaiExecFk", insertable = false, updatable = false)
	private Integer statusPegawaiExecId;

	@Caption(value = "Deskripsi Status Pegawai Exec")
	@Column(name = "DeskripsiStatusPegawaiExec", length = 1000)
	private String deskripsiStatusPegawaiExec;

	@Caption(value = "Keterangan Lainya Exec")
	@Column(name = "KeteranganLainyaExec", length = 1000)
	private String keteranganLainyaExec;

	@Caption(value = "Tgl Pengajuan")
	@Column(name = "TglPengajuan")
	private Date tglPengajuan;

	@Caption(value = "Tgl Keputusan")
	@Column(name = "TglKeputusan")
	private Date tglKeputusan;

	@Caption(value = "Approval Status")
	@Column(name = "ApprovalStatus")
	private Integer approvalStatus;

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

	@Caption(value = "keterangan")
	@Column(name = "keterangan")
	private String keterangan;

	@Caption(value = "Jenis Perawatan")
	@Column(name = "jenisPerawatan")
	private Integer jenisPerawatan;

	@Caption(value = "Alamat Selama Cuti")
	@Column(name = "alamatCuti")
	private String alamatCuti;

	@Caption(value = "Nomor Telepon")
	@Column(name = "nomorTelepon")
	private String nomorTelepon;

	@Caption(value = "Nomor Surat Tugas")
	@Column(name = "noSuratTugas")
	private String noSuratTugas;

	@Caption(value = "Nomor Nota Dinas")
	@Column(name = "noNotaDinas")
	private String noNotaDinas;

	@Caption(value = "Tgl Nota Dinas")
	@Column(name = "TglNotaDinas")
	private Date tglNotaDinas;

	@Caption(value = "Alamat Tugas Dinas")
	@Column(name = "alamatTugas")
	private String alamatTugas;

	@ManyToOne(fetch = FetchType.LAZY)
	@Caption(value = "Object Jabatan Pemberi Nota Dinas")
	@JoinColumn(name = "ObjectJabatanPemberiNotaDinasFk")
	private Jabatan jabatanPemberiNotaDinas;

	@Column(name = "ObjectJabatanPemberiNotaDinasFk", insertable = false, updatable = false)
	private Integer jabatanIdPemberiNotaDinas;

	@Caption(value = "is Cuti Luar Negeri")
	@Column(name = "isCutiLuarNegeri")
	private Boolean isCutiLuarNegeri;

	@Caption(value = "is Cuti Luar Kota")
	@Column(name = "isCutiLuarKota")
	private Boolean isCutiLuarKota;

}
