package com.jasamedika.medifirst2000.entities;

import java.sql.Date;
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.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
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 = "IpsrsPemakaianMesin_T")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class IpsrsPemakaianMesin extends BaseTransaction{
	
	@NotNull(message = "Tanggal tidak boleh kososng")
	@Caption(value = "Tanggal")
	@Column(name = "Tanggal", nullable = false)
	private Date tanggal;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectPegawaiFk")
	@Caption(value = "Pegawai")
	private Pegawai pegawai;
	
	@Column(name = "ObjectPegawaiFk",insertable = false, updatable = false)
	private Integer pegawaiId;
	
	@JsonBackReference
	@OneToOne(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "ipsrsPemakaianMesin")
	private IpsrsMesinBoiler ipsrsMesinBoiler;
	
	@JsonBackReference
	@OneToOne(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "ipsrsPemakaianMesin")
	private IpsrsMesinGenset ipsrsMesinGenset;

	public Date getTanggal() {
		return tanggal;
	}

	public void setTanggal(Date tanggal) {
		this.tanggal = tanggal;
	}

	public Pegawai getPegawai() {
		return pegawai;
	}

	public void setPegawai(Pegawai pegawai) {
		this.pegawai = pegawai;
	}

	public Integer getPegawaiId() {
		return pegawaiId;
	}

	public void setPegawaiId(Integer pegawaiId) {
		this.pegawaiId = pegawaiId;
	}

	public IpsrsMesinBoiler getIpsrsMesinBoiler() {
		return ipsrsMesinBoiler;
	}

	public void setIpsrsMesinBoiler(IpsrsMesinBoiler ipsrsMesinBoiler) {
		this.ipsrsMesinBoiler = ipsrsMesinBoiler;
	}

	public IpsrsMesinGenset getIpsrsMesinGenset() {
		return ipsrsMesinGenset;
	}

	public void setIpsrsMesinGenset(IpsrsMesinGenset ipsrsMesinGenset) {
		this.ipsrsMesinGenset = ipsrsMesinGenset;
	}

	
}
