package com.jasamedika.medifirst2000.entities;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.jasamedika.medifirst2000.base.BaseMaster;

@Entity
@Table(name = "NotifMessagingScheduler_S")
@JsonSerialize
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class NotifMessagingScheduler extends BaseMaster {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3097911644440148472L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "public.notifikasi_modul_message_s_id_seq")
	@javax.persistence.SequenceGenerator(
			name = "public.notifikasi_modul_message_s_id_seq", 
			sequenceName = "public.notifikasi_modul_message_s_id_seq", 
			allocationSize = 1
	)	
	@Column(name = "id")
	private Integer id;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	@Column(name = "TglKirim")
	@Temporal(TemporalType.DATE)
	private Date tglKirim;
	
	public Date getTglKirim() {
		return tglKirim;
	}

	public void setTglKirim(Date tglKirim) {
		this.tglKirim = tglKirim;
	}
	
	private boolean terkirim;

	public boolean isTerkirim() {
		return terkirim;
	}

	public void setTerkirim(boolean terkirim) {
		this.terkirim = terkirim;
	}
	
	///////////////////////////
	// Foreign Key
	///////////////////////////
	

	@Column(name = "NotifMessagingId")
	private Integer notifMessagingId;
	
	public Integer getNotifMessagingId() {
		return notifMessagingId;
	}

	public void setNotifMessagingId(Integer notifMessagingId) {
		this.notifMessagingId = notifMessagingId;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "notifMessagingId", insertable = false, updatable = false)
	@JsonIgnore
	private NotifMessaging notifMessaging;

	public NotifMessaging getNotifMessaging() {
		return notifMessaging;
	}

	public void setNotifMessaging(NotifMessaging notifMessaging) {
		this.notifMessaging = notifMessaging;
	}
	
	@Column(name = "RuanganIdAsal")
	private Integer ruanganIdAsal;

	public Integer getRuanganIdAsal() {
		return ruanganIdAsal;
	}

	public void setRuanganIdAsal(Integer ruanganId) {
		this.ruanganIdAsal = ruanganId;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
	@JoinColumn(name = "ruanganIdAsal", insertable = false, updatable = false)
	@JsonIgnore
	private Ruangan ruanganAsal;

	public Ruangan getRuanganAsal() {
		return ruanganAsal;
	}

	public void setRuanganAsal(Ruangan ruangan) {
		this.ruanganAsal = ruangan;
	}
	
	@Column(name = "RuanganIdTujuan")
	private Integer ruanganIdTujuan;
	
	public Integer getRuanganIdTujuan() {
		return ruanganIdTujuan;
	}
	public void setRuanganIdTujuan(Integer ruanganIdTujuan) {
		this.ruanganIdTujuan = ruanganIdTujuan;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
	@JoinColumn(name = "ruanganIdTujuan", insertable = false, updatable = false)
	@JsonIgnore
	private Ruangan ruanganTujuan;
	
	public Ruangan getRuanganTujuan() {
		return ruanganTujuan;
	}
	
	public void setRuanganTujuan(Ruangan ruanganTujuan) {
		this.ruanganTujuan = ruanganTujuan;
	}
	
	@Column(name = "PegawaiId")
	private Integer pegawaiId;
	
	public Integer getPegawaiId() {
		return pegawaiId;
	}
	
	public void setPegawaiId(Integer pegawaiId) {
		this.pegawaiId = pegawaiId;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
	@JoinColumn(name = "pegawaiId", insertable = false, updatable = false)
	@JsonIgnore
	private Pegawai pegawai;
	
	public Pegawai getPegawai() {
		return pegawai;
	}
	
	public void setPegawai(Pegawai pegawai) {
		this.pegawai = pegawai;
	}

}
