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.JsonBackReference;
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 KotaKabupaten
 * 
 * @author Generator
 */
@Entity // @Audited
@Table(name = "KotaKabupaten_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class KotaKabupaten extends BaseMaster {
	@NotNull(message = "Kd Kota Kabupaten tidak boleh kosong")
	@Column(name = "KdKotaKabupaten", nullable = false)
	@Caption(value = "Kode Kota Kabupaten")
	private short kdKotaKabupaten;

	public void setKdKotaKabupaten(short kdKotaKabupaten) {
		this.kdKotaKabupaten = kdKotaKabupaten;
	}

	public short getKdKotaKabupaten() {
		return this.kdKotaKabupaten;
	}

	@JsonBackReference
	@ManyToOne
	@JoinColumn(name = "ObjectPropinsiFk")
	@NotNull(message = "Kd Propinsi tidak boleh kosong")
	@Caption(value = "Object Propinsi")
	private Propinsi propinsi;

	public void setPropinsi(Propinsi propinsi) {
		this.propinsi = propinsi;
	}

	public Propinsi getPropinsi() {
		return this.propinsi;
	}

	@Column(name = "ObjectPropinsiFk", insertable = false, updatable = false, nullable = false)
	private Integer propinsiId;

	@NotNull(message = "Nama Kota Kabupaten tidak boleh kosong")
	@Column(name = "NamaKotaKabupaten", nullable = false, length = 50)
	@Caption(value = "Nama Kota Kabupaten")
	private String namaKotaKabupaten;

	public void setNamaKotaKabupaten(String namaKotaKabupaten) {
		this.namaKotaKabupaten = namaKotaKabupaten;
	}

	public String getNamaKotaKabupaten() {
		return this.namaKotaKabupaten;
	}

	@NotNull(message = "QKota Kabupaten tidak boleh kosong")
	@Column(name = "QKotaKabupaten", nullable = false)
	@Caption(value = "QKota Kabupaten")
	private short qKotaKabupaten;

	public void setqKotaKabupaten(short qKotaKabupaten) {
		this.qKotaKabupaten = qKotaKabupaten;
	}

	public short getqKotaKabupaten() {
		return this.qKotaKabupaten;
	}

	/*
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL,
	 * mappedBy="kdkotakabupaten") private Set<Alamat> AlamatSet = new
	 * HashSet<Alamat>();
	 * 
	 * public Set<Alamat> getAlamatSet() { return AlamatSet; }
	 * 
	 * public void setAlamatSet(Set<Alamat> alamatSet) { AlamatSet = alamatSet;
	 * }
	 * 
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy =
	 * "kdkotakabupaten") private Set<DesaKelurahan> DesaKelurahanSet = new
	 * HashSet<DesaKelurahan>();
	 * 
	 * public Set<DesaKelurahan> getDesaKelurahanSet() { return
	 * DesaKelurahanSet; }
	 * 
	 * public void setDesaKelurahanSet(Set<DesaKelurahan> desaKelurahanSet) {
	 * DesaKelurahanSet = desaKelurahanSet; }
	 * 
	 * @JsonManagedReference
	 * 
	 * @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy =
	 * "kdkotakabupaten") private Set<Kecamatan> KecamatanSet = new
	 * HashSet<Kecamatan>();
	 * 
	 * public Set<Kecamatan> getKecamatanSet() { return KecamatanSet; }
	 * 
	 * public void setKecamatanSet(Set<Kecamatan> kecamatanSet) { KecamatanSet =
	 * kecamatanSet; }
	 */

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

	public Integer getId() {

		return id;
	}

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