package com.jasamedika.medifirst2000.entities;

import com.jasamedika.medifirst2000.base.BaseActive;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.NotBlank;

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

import static javax.persistence.GenerationType.SEQUENCE;

/**
 * @author salmanoe
 * @version 1.0.0
 * @since 04/03/2024
 */
@Getter
@Setter
@Entity
@Table(name = "periode_monitoring_m", schema = "mkko")
public class PeriodeMonitoring extends BaseActive implements Serializable {
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "sg_periode_monitoring_m")
	@SequenceGenerator(name = "sg_periode_monitoring_m", schema = "mkko", sequenceName = "mkko.periode_monitoring_m_seq", allocationSize = 1)
	@Column(name = "id", columnDefinition = "bigint default nextval('mkko.periode_monitoring_m_seq'::regclass)")
	protected Long id;

	@Column(name = "periode", length = 50, unique = true, nullable = false)
	@Size(max = 50, message = "Periode maksimal {max} karakter")
	@NotBlank(message = "Periode tidak boleh kosong")
	@Caption("Periode")
	private String periode;
}
