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;

@Entity
@Table(name = "IpsrsPemeliharaan_T")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class IpsrsPemeliharaan extends BaseTransaction{
	
	@ManyToOne(fetch = FetchType.LAZY)
	@Caption(value = "Ipsrs Maintenance")
	@JoinColumn(name = "ObjectIpsrsMaintenanceFk")
	private IpsrsMaintenance ipsrsMaintenance;
	
	@Column(name = "ObjectIpsrsMaintenanceFk", columnDefinition = "CHAR(32)", nullable = true, insertable = false, updatable = false)
	private String ipsrsMaintenanceId;
	
	@Caption(value = "Jadwal Pemeliharaan")
	@Column(name = "JadwalPemeliharaan", nullable = true)
	private Date jadwalPemeliharaan;

	@Caption(value = "Alert Pemeliharaan")
	@Column(name = "AlertPemeliharaan", nullable = true)
	private Date alertPemeliharaan;
	
	@Caption(value = "Status Pemeliharaan")
	@Column(name = "StatusPemeliharaan", nullable = true)
	private String statusPemeliharaan;

	@JsonBackReference
	@OneToMany(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "ipsrsPemeliharaan")
	private Set<IpsrsTeknisiPemeliharaan> ipsrsTeknisiPemeliharaan = new HashSet<>();

	public IpsrsMaintenance getIpsrsMaintenance() {
		return ipsrsMaintenance;
	}

	public void setIpsrsMaintenance(IpsrsMaintenance ipsrsMaintenance) {
		this.ipsrsMaintenance = ipsrsMaintenance;
	}

	public String getIpsrsMaintenanceId() {
		return ipsrsMaintenanceId;
	}

	public void setIpsrsMaintenanceId(String ipsrsMaintenanceId) {
		this.ipsrsMaintenanceId = ipsrsMaintenanceId;
	}

	public Date getJadwalPemeliharaan() {
		return jadwalPemeliharaan;
	}

	public void setJadwalPemeliharaan(Date jadwalPemeliharaan) {
		this.jadwalPemeliharaan = jadwalPemeliharaan;
	}

	public Date getAlertPemeliharaan() {
		return alertPemeliharaan;
	}

	public void setAlertPemeliharaan(Date alertPemeliharaan) {
		this.alertPemeliharaan = alertPemeliharaan;
	}

	public String getStatusPemeliharaan() {
		return statusPemeliharaan;
	}

	public void setStatusPemeliharaan(String statusPemeliharaan) {
		this.statusPemeliharaan = statusPemeliharaan;
	}

	public Set<IpsrsTeknisiPemeliharaan> getIpsrsTeknisiPemeliharaan() {
		return ipsrsTeknisiPemeliharaan;
	}

	public void setIpsrsTeknisiPemeliharaan(Set<IpsrsTeknisiPemeliharaan> ipsrsTeknisiPemeliharaan) {
		this.ipsrsTeknisiPemeliharaan = ipsrsTeknisiPemeliharaan;
	}


}
