package com.jasamedika.medifirst2000.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
@Table(name = "MappingMesinToProduk_M")
public class Mesin extends BaseMaster {

	// private static final long serialVersionUID = 8921967062006223194L;
	public Mesin(Produk mesin, Integer kapasitas, Integer id) {
		super();
		this.mesin = mesin;
		this.kapasitas = kapasitas;
		this.id = id;
	}

	public Mesin() {
		super();
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectMesinFk")
	private Produk mesin;

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

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectSatuanFk")
	private SatuanStandar satuan;

	@Column(name = "ObjectSatuanFk", insertable = false, updatable = false)
	private Integer satuanId;

	@Caption(value = "Kapasitas")
	@Column(name = "Kapasitas", nullable = true)
	private Integer kapasitas;

	public SatuanStandar getSatuan() {
		return satuan;
	}

	public void setSatuan(SatuanStandar satuan) {
		this.satuan = satuan;
	}

	public Produk getMesin() {
		return mesin;
	}

	public void setMesin(Produk mesin) {
		this.mesin = mesin;
	}

	public Integer getKapasitas() {
		return kapasitas;
	}

	public void setKapasitas(Integer kapasitas) {
		this.kapasitas = kapasitas;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "public.mesin_m_id_seq")
	@javax.persistence.SequenceGenerator(name = "public.mesin_m_id_seq", sequenceName = "public.mesin_m_id_seq", allocationSize = 1)
	@Column(name = "id")
	protected Integer id;

	public Integer getId() {

		return id;
	}

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