package com.jasamedika.medifirst2000.entities;

import java.util.Set;

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.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

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 = "NotifMessaging_S")
@JsonSerialize
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class NotifMessaging extends BaseMaster {

	private static final long serialVersionUID = 185150794807887078L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "public.notif_messaging_s_id_seq")
	@javax.persistence.SequenceGenerator(
			name = "public.notif_messaging_s_id_seq", 
			sequenceName = "public.notif_messaging_s_id_seq", 
			allocationSize = 1
	)
	@Column(name = "id")
	private Integer id;
	
	@Column(name = "nama")
	private String nama;
	
	@Column(name = "deskripsi")
	private String deskripsi;	
	
	@Column(name = "keterangan")
	private String keterangan;
	
	@Column(name = "urlBackEnd")
	private String urlBackEnd;
	

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getNama() {
		return nama;
	}

	public void setNama(String nama) {
		this.nama = nama;
	}

	public String getDeskripsi() {
		return deskripsi;
	}

	public void setDeskripsi(String deskripsi) {
		this.deskripsi = deskripsi;
	}

	public String getKeterangan() {
		return keterangan;
	}

	public void setKeterangan(String keterangan) {
		this.keterangan = keterangan;
	}

	public String getUrlBackEnd() {
		return urlBackEnd;
	}

	public void setUrlBackEnd(String urlBackEnd) {
		this.urlBackEnd = urlBackEnd;
	}
	

	/////////////////////
	/// Foreign Keys
	//////////////////


	@Column(name = "ObjekModulAplikasiId")
	private Integer objekModulAplikasiId;

	public Integer getObjekModulAplikasiId() {
		return objekModulAplikasiId;
	}

	public void setObjekModulAplikasiId(Integer objekModulAplikasiId) {
		this.objekModulAplikasiId = objekModulAplikasiId;
	}

	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinColumn(name = "objekModulAplikasiId", insertable = false, updatable = false)
	private ObjekModulAplikasi objekModulAplikasi;

	public ObjekModulAplikasi getObjekModulAplikasi() {
		return objekModulAplikasi;
	}

	public void setObjekModulAplikasi(ObjekModulAplikasi objekModulAplikasi) {
		this.objekModulAplikasi = objekModulAplikasi;
	}

	@NotFound(action = NotFoundAction.IGNORE)
	@OneToMany(mappedBy = "notifMessaging")	
	@JsonIgnore
	private Set<NotifikasiMessageObjekModul> notifikasiMessageObjekModul;

	public Set<NotifikasiMessageObjekModul> getNotifikasiMessageObjekModul() {
		return notifikasiMessageObjekModul;
	}

	public void setNotifikasiMessageObjekModul(Set<NotifikasiMessageObjekModul> notifikasiMessageObjekModul) {
		this.notifikasiMessageObjekModul = notifikasiMessageObjekModul;
	}

}
