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 Negara
 * 
 * @author Generator
 */
@Entity // @Audited
@Table(name = "Negara_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class Negara extends BaseMaster {
	@NotNull(message = "Kd Negara tidak boleh kosong")
	@Column(name = "KdNegara", nullable = false)
	@Caption(value = "Kode Negara")
	private Byte kdNegara;

	public void setKdNegara(Byte kdNegara) {
		this.kdNegara = kdNegara;
	}

	public Byte getKdNegara() {
		return this.kdNegara;
	}

	@NotNull(message = "Nama Negara tidak boleh kosong")
	@Column(name = "NamaNegara", nullable = false, length = 50)
	@Caption(value = "Nama Negara")
	private String namaNegara;

	public void setNamaNegara(String namaNegara) {
		this.namaNegara = namaNegara;
	}

	public String getNamaNegara() {
		return this.namaNegara;
	}

	@NotNull(message = "QNegara tidak boleh kosong")
	@Column(name = "QNegara", nullable = false)
	@Caption(value = "QNegara")
	private Byte qNegara;

	public void setqNegara(Byte qNegara) {
		this.qNegara = qNegara;
	}

	public Byte getqNegara() {
		return this.qNegara;
	}

	/*
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL,
	 * mappedBy="kdnegara") private Set<Alamat> AlamatSet = new
	 * HashSet<Alamat>();
	 * 
	 * public Set<Alamat> getAlamatSet() { return AlamatSet; }
	 * 
	 * public void setAlamatSet(Set<Alamat> alamatSet) { AlamatSet = alamatSet;
	 * }
	 */

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

	public Integer getId() {

		return id;
	}

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