package com.jasamedika.medifirst2000.entities;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.base.BaseTransaction;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import static javax.persistence.FetchType.LAZY;

@Getter
@Setter
@Entity
@Table(name = "IpsrsMesinBoiler_T")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class IpsrsMesinBoiler extends BaseTransaction {

	@OneToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectIpsrsPemakaianMesinFk")
	@Caption(value = "Ipsrs Pemakaian Mesin")
	private IpsrsPemakaianMesin ipsrsPemakaianMesin;

	@Column(name = "ObjectIpsrsPemakaianMesinFk", columnDefinition = "CHAR(32)", nullable = false, insertable = false, updatable = false)
	private String ipsrsPemakaianMesinId;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectMesinFk")
	@Caption(value = "Mesin")
	private Produk mesin;

	@Column(name = "ObjectMesinFk", nullable = false, insertable = false, updatable = false)
	private Integer mesinId;

	@NotNull(message = "Liter Pemakaian Awal tidak boleh kosong")
	@Caption(value = "Liter Pemakaian Awal")
	@Column(name = "LiterPemakaianAwal", nullable = false)
	private float literPemakaianAwal;

	@NotNull(message = "Liter Pemakaian Ahir tidak boleh kosong")
	@Caption(value = "Liter Pemakaian Ahir")
	@Column(name = "LiterPemakaianAhir", nullable = false)
	private float literPemakaianAhir;

	@Caption(value = "Total Pemakaian")
	@Column(name = "TotalPemakaian", nullable = false)
	private float totalPemakaian;

}
