package com.jasamedika.medifirst2000.entities;

import java.io.Serializable;
import org.hibernate.envers.Audited;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.*;

import org.hibernate.validator.constraints.NotEmpty;

import com.jasamedika.medifirst2000.base.BaseMaster;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.internal.util.logging.Messages;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import org.hibernate.envers.Audited;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 * class JenisAset
 * 
 * @author Generator
 */
@Entity // @Audited
@Table(name = "JenisAset_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class JenisAset extends BaseMaster {
	@Caption(value = "Jenis Aset")
	private String jenisAset;

	public void setJenisAset(String jenisAset) {
		this.jenisAset = jenisAset;
	}

	@NotNull(message = "Jenis Aset tidak boleh kosong")
	@Column(name = "JenisAset", nullable = false, length = 50)
	public String getJenisAset() {
		return this.jenisAset;
	}

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

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

	public ChartOfAccount getAccount() {
		return this.account;
	}

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

	@ManyToOne
	@JoinColumn(name = "ObjectDepartemenFk")
	@NotNull(message = "Object Departemen Harus Diisi")
	@Caption(value = "Object Departemen")
	private Departemen departemen;

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

	@NotNull(message = "Kd Departemen tidak boleh kosong")

	public Departemen getDepartemen() {
		return this.departemen;
	}

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

	@Caption(value = "Kode Jenis Aset")
	private Byte kdJenisAset;

	public void setKdJenisAset(Byte kdJenisAset) {
		this.kdJenisAset = kdJenisAset;
	}

	@NotNull(message = "Kd Jenis Aset tidak boleh kosong")
	@Column(name = "KdJenisAset", nullable = false)
	public Byte getKdJenisAset() {
		return this.kdJenisAset;
	}

	@ManyToOne
	@JoinColumn(name = "ObjectJenisAsetHeadFk")
	@Caption(value = "Object Jenis Aset Head")
	private JenisAset jenisAsetHead;

	public void setJenisAsetHead(JenisAset jenisAsetHead) {
		this.jenisAsetHead = jenisAsetHead;
	}

	public JenisAset getJenisAsetHead() {
		return this.jenisAsetHead;
	}

	@Column(name = "ObjectJenisAsetHeadFk", insertable = false, updatable = false)
	private Integer jenisAsetHeadId;

	@Caption(value = "QJenis Aset")
	private Byte qJenisAset;

	public void setqJenisAset(Byte qJenisAset) {
		this.qJenisAset = qJenisAset;
	}

	@NotNull(message = "QJenis Aset tidak boleh kosong")
	@Column(name = "QJenisAset", nullable = false)
	public Byte getqJenisAset() {
		return this.qJenisAset;
	}

	/*
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy =
	 * "kdjenisasethead") private Set<JenisAset> JenisAsetSet = new
	 * HashSet<JenisAset>();
	 * 
	 * public Set<JenisAset> getJenisAsetSet() { return JenisAsetSet; }
	 * 
	 * public void setJenisAsetSet(Set<JenisAset> jenisAsetSet) { JenisAsetSet =
	 * jenisAsetSet; }
	 * 
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy =
	 * "kdjenisaset") private Set<KelompokAset> KelompokAsetSet = new
	 * HashSet<KelompokAset>();
	 * 
	 * public Set<KelompokAset> getKelompokAsetSet() { return KelompokAsetSet; }
	 * 
	 * public void setKelompokAsetSet(Set<KelompokAset> kelompokAsetSet) {
	 * KelompokAsetSet = kelompokAsetSet; }
	 */

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

	public Integer getId() {

		return id;
	}

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