package com.jasamedika.medifirst2000.entities;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import javax.validation.constraints.Size;
import java.io.Serializable;

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

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 08/11/2023
 */
@Getter
@Setter
@Entity
@Table(name = "migrasikotakabupaten_m")
public class MigrasiKotaKabupaten implements Serializable {

	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "sg_migrasikotakabupaten_m")
	@SequenceGenerator(name = "sg_migrasikotakabupaten_m", sequenceName = "migrasikotakabupaten_m_seq", allocationSize = 1)
	private Long id;

	@Column(length = 5)
	@Size(max = 5)
	private String kodeKemendagri;

	private String kotaAtauKabupaten;

	@ManyToOne(fetch = LAZY)
	@JoinColumn(name = "migrasiprovinsifk")
	@ToString.Exclude
	private MigrasiProvinsi migrasiProvinsi;

}
