package com.jasamedika.medifirst2000.entities;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import static javax.persistence.FetchType.LAZY;
import static javax.persistence.GenerationType.SEQUENCE;

/**
 * class KotaKabupaten
 * 
 * @author Generator
 */
@Getter
@Setter
@Entity
@Table(name = "KotaKabupaten_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class KotaKabupaten extends BaseMaster {

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

	@NotNull(message = "Kd Kota Kabupaten tidak boleh kosong")
	@Column(name = "KdKotaKabupaten", nullable = false)
	@Caption(value = "Kode Kota Kabupaten")
	private short kdKotaKabupaten;

	@JsonBackReference
	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "ObjectPropinsiFk")
	@NotNull(message = "Kd Propinsi tidak boleh kosong")
	@Caption(value = "Object Propinsi")
	private Propinsi 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;

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

}