package com.jasamedika.medifirst2000.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;

@Entity
@Table(name = "DetailJenisProduk_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class DetailJenisProduk extends BaseMaster {
	
	public DetailJenisProduk() {}
	
	public DetailJenisProduk(String detailJenisProduk, String kdDetailJenisProduk, Integer id) {
		super();
		this.id = id;
		this.detailJenisProduk = detailJenisProduk;
		this.kdDetailJenisProduk = kdDetailJenisProduk;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "public.detailjenisproduk_m_id_seq")
	@javax.persistence.SequenceGenerator(name = "public.detailjenisproduk_m_id_seq", sequenceName = "public.detailjenisproduk_m_id_seq", allocationSize = 1)
	@Column(name = "id")
	protected Integer id;

	@NotNull(message = "Detail Jenis Produk tidak boleh kosong")
	@Column(name = "DetailJenisProduk", nullable = false, length = 50)
	@Caption(value = "Detail Jenis Produk")
	private String detailJenisProduk;

	@Column(name = "isRegistrasiAset", nullable = true)
	@Caption(value = "Is Registrasi Aset")
	private Byte isRegistrasiAset;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectAccountFk")
	@Caption(value = "Object Account")
	private ChartOfAccount account;

	@Column(name = "ObjectAccountFk", insertable = false, updatable = false)
	private Integer accountId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectDepartemenFk")
	@NotNull(message = "Kd Departemen tidak boleh kosong")
	@Caption(value = "Object Departemen")
	private Departemen departemen;

	@Column(name = "ObjectDepartemenFk", insertable = false, updatable = false)
	private Integer departemenId;

	@NotNull(message = "Kd Detail Jenis Produk tidak boleh kosong")
	@Column(name = "KdDetailJenisProduk", nullable = false, length = 4)
	@Caption(value = "Kode Detail Jenis Produk")
	private String kdDetailJenisProduk;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ObjectJenisProdukFk")
	@NotNull(message = "Kd Jenis Produk tidak boleh kosong")

	@Caption(value = "Object Jenis Produk")
	private JenisProduk jenisProduk;

	@Column(name = "ObjectJenisProdukFk", insertable = false, updatable = false, nullable = false)
	private Integer jenisProdukId;

	@NotNull(message = "Persen Harga Cito tidak boleh kosong")
	@Column(name = "PersenHargaCito", nullable = false)
	@Caption(value = "Persen Harga Cito")
	private Double persenHargaCito;

	@NotNull(message = "QDetail Jenis Produk tidak boleh kosong")
	@Column(name = "QDetailJenisProduk", nullable = false)
	@Caption(value = "QDetail Jenis Produk")
	private short qDetailJenisProduk;

	public Integer getId() {
		return id;
	}

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

	public String getDetailJenisProduk() {
		return detailJenisProduk;
	}

	public void setDetailJenisProduk(String detailJenisProduk) {
		this.detailJenisProduk = detailJenisProduk;
	}

	public Byte getIsRegistrasiAset() {
		return isRegistrasiAset;
	}

	public void setIsRegistrasiAset(Byte isRegistrasiAset) {
		this.isRegistrasiAset = isRegistrasiAset;
	}

	public ChartOfAccount getAccount() {
		return account;
	}

	public void setAccount(ChartOfAccount account) {
		this.account = account;
	}

	public Integer getAccountId() {
		return accountId;
	}

	public void setAccountId(Integer accountId) {
		this.accountId = accountId;
	}

	public Departemen getDepartemen() {
		return departemen;
	}

	public void setDepartemen(Departemen departemen) {
		this.departemen = departemen;
	}

	public Integer getDepartemenId() {
		return departemenId;
	}

	public void setDepartemenId(Integer departemenId) {
		this.departemenId = departemenId;
	}

	public String getKdDetailJenisProduk() {
		return kdDetailJenisProduk;
	}

	public void setKdDetailJenisProduk(String kdDetailJenisProduk) {
		this.kdDetailJenisProduk = kdDetailJenisProduk;
	}

	public JenisProduk getJenisProduk() {
		return jenisProduk;
	}

	public void setJenisProduk(JenisProduk jenisProduk) {
		this.jenisProduk = jenisProduk;
	}

	public Integer getJenisProdukId() {
		return jenisProdukId;
	}

	public void setJenisProdukId(Integer jenisProdukId) {
		this.jenisProdukId = jenisProdukId;
	}

	public Double getPersenHargaCito() {
		return persenHargaCito;
	}

	public void setPersenHargaCito(Double persenHargaCito) {
		this.persenHargaCito = persenHargaCito;
	}

	public short getqDetailJenisProduk() {
		return qDetailJenisProduk;
	}

	public void setqDetailJenisProduk(short qDetailJenisProduk) {
		this.qDetailJenisProduk = qDetailJenisProduk;
	}

}