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.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
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 = "ItPerbaikan_T")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class ItPerbaikan extends BaseTransaction{

	@Caption(value = "No Order")
	@Column(name = "NoOrder", nullable = true)
	private String noOrder;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Caption(value = "Tanggal Pesan")
	@NotNull(message="Tanggal Pesan tidak boleh kosong")
	@Column(name = "TanggalPesan", nullable = false)
	private Date tglPesan;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectRegistrasiAsetFk")
	@Caption(value = "Registrasi Aset")
	private RegistrasiAset registrasiAset;
	
	@Column(name = "ObjectRegistrasiAsetFk", columnDefinition = "CHAR(32)", nullable=true, insertable = false, updatable = false)
	private String registrasiAsetId;
	
	@Caption(value = "Keluhan")
	@NotNull(message="Keluhan tidak boleh kosong")
	@Column(name = "Keluhan", nullable = false)
	private String keluhan;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectPelaporFk")
	@Caption(value = "Pelapor")
	private Pegawai pelapor;
	
	@Column(name = "ObjectPelaporFk",nullable=false, insertable = false, updatable = false)
	private Integer pelaporId;
	
	@JsonBackReference
	@OneToOne(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "itPerbaikan")
	private ItStatusPerbaikan itStatusPerbaikan;
	
	@JsonBackReference
	@OneToOne(cascade=CascadeType.ALL,fetch = FetchType.LAZY, mappedBy = "itPerbaikan")
	private ItPelaksanaanPerbaikan itPelaksanaanPerbaikan;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="ObjectStrukOrderFk")
	private StrukOrder strukOrder;
	
	@Column(name="ObjectStrukOrderFk", insertable=false, updatable=false, nullable=false)
	private String strukOrderId;

	public String getNoOrder() {
		return noOrder;
	}

	public void setNoOrder(String noOrder) {
		this.noOrder = noOrder;
	}

	public Date getTglPesan() {
		return tglPesan;
	}

	public void setTglPesan(Date tglPesan) {
		this.tglPesan = tglPesan;
	}

	public RegistrasiAset getRegistrasiAset() {
		return registrasiAset;
	}

	public void setRegistrasiAset(RegistrasiAset registrasiAset) {
		this.registrasiAset = registrasiAset;
	}

	public String getRegistrasiAsetId() {
		return registrasiAsetId;
	}

	public void setRegistrasiAsetId(String registrasiAsetId) {
		this.registrasiAsetId = registrasiAsetId;
	}

	public String getKeluhan() {
		return keluhan;
	}

	public void setKeluhan(String keluhan) {
		this.keluhan = keluhan;
	}

	public Pegawai getPelapor() {
		return pelapor;
	}

	public void setPelapor(Pegawai pelapor) {
		this.pelapor = pelapor;
	}

	public Integer getPelaporId() {
		return pelaporId;
	}

	public void setPelaporId(Integer pelaporId) {
		this.pelaporId = pelaporId;
	}

	public ItStatusPerbaikan getItStatusPerbaikan() {
		return itStatusPerbaikan;
	}

	public void setItStatusPerbaikan(ItStatusPerbaikan itStatusPerbaikan) {
		this.itStatusPerbaikan = itStatusPerbaikan;
	}

	public ItPelaksanaanPerbaikan getItPelaksanaanPerbaikan() {
		return itPelaksanaanPerbaikan;
	}

	public void setItPelaksanaanPerbaikan(ItPelaksanaanPerbaikan itPelaksanaanPerbaikan) {
		this.itPelaksanaanPerbaikan = itPelaksanaanPerbaikan;
	}

	public StrukOrder getStrukOrder() {
		return strukOrder;
	}

	public void setStrukOrder(StrukOrder strukOrder) {
		this.strukOrder = strukOrder;
	}

	public String getStrukOrderId() {
		return strukOrderId;
	}

	public void setStrukOrderId(String strukOrderId) {
		this.strukOrderId = strukOrderId;
	}
	
	

	
}
