package com.jasamedika.medifirst2000.entities;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.base.BaseMaster;
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;
import static javax.persistence.GenerationType.SEQUENCE;

/**
 * class KeluargaPegawai
 * 
 * @author Lukman Hakim (lukman.uki@gmail.com)
 * @Date 31 Januari 2016
 * 
 */
@Getter
@Setter
@Entity
@Table(name = "keluargapegawai_m")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class KeluargaPegawai extends BaseMaster {

	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "public.keluargapegawai_m_id_seq")
	@SequenceGenerator(name = "public.keluargapegawai_m_id_seq", sequenceName = "public.keluargapegawai_m_id_seq", allocationSize = 1)
	@Column(name = "id")
	protected Integer id;

	@Column(name = "NoUrut", length = 100)
	@Caption(value = "NoUrut")
	private String noUrut;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "objectPegawaiFk")
	@Caption(value = "objectPegawaiFk")
	private Pegawai pegawai;

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

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "objectKdHubunganFk")
	@Caption(value = "objectKdHubunganFk")
	private HubunganKeluarga hubunganKeluarga;

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

	@Caption(value = "Nama Lengkap")
	@NotNull(message = "Nama Lengkap tidak boleh kosong")
	@Column(name = "NamaLengkap", nullable = false, length = 40)
	private String namaLengkap;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectJenisKelaminFk")
	@Caption(value = "Object Jenis Kelamin")
	private JenisKelamin jenisKelamin;

	@Column(name = "ObjectJenisKelaminFk", insertable = false, updatable = false)
	private Integer jenisKelaminId;

	@Column(name = "TglLahir", nullable = false)
	private Date tglLahir;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "objectPekerjaanFk")
	@Caption(value = "Object Pekerjaan")
	private Pekerjaan pekerjaan;

	@Column(name = "objectPekerjaanFk", insertable = false, updatable = false)
	private Integer pekerjaanId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectPendidikanTerakhirFk")
	@Caption(value = "Object Pendidikan Terakhir")
	private Pendidikan pendidikan;

	@Column(name = "ObjectPendidikanTerakhirFk", insertable = false, updatable = false)
	private Integer pendidikanId;

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

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "statusTanggunganFk")
	@Caption(value = "statusTanggunganFk")
	private Tanggungan statusTanggungan;

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

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectStatusPerkawinanPegawaiFk")
	@Caption(value = "Object Status Perkawinan Pegawai")
	private StatusPerkawinanPegawai statusPerkawinanPegawai;

	@Column(name = "ObjectStatusPerkawinanPegawaiFk", insertable = false, updatable = false)
	private Integer statusPerkawinanPegawaiId;

	@Column(name = "NoSuratKuliah")
	private String noSuratKuliah;

	@Column(name = "TglsuratKuliah")
	private Date tglsuratKuliah;

	@Column(name = "TglNikah")
	private Date tglNikah;

	@Column(name = "TempatNikah")
	private String tempatNikah;

	@Column(name = "Namaayah")
	private String namaAyah;

	@Column(name = "NamaIbu")
	private String namaIbu;

	@Column(name = "NipIstriSuami")
	private String nipIstriSuami;

	@Column(name = "Alamat")
	private String alamat;

}
