package com.kamco.cd.kamcoback.Innopam.postgres.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.ZonedDateTime;
import java.util.UUID;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;

@Getter
@Setter
@Entity
@Table(name = "detect_mast")
public class DetectMastEntity {

  @Id
  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "detect_mast_id_gen")
  @SequenceGenerator(
      name = "detect_mast_id_gen",
      sequenceName = "seq_detect_mast_id",
      allocationSize = 1)
  @Column(name = "dtct_mst_id", nullable = false)
  private Long id;

  @NotNull
  @ColumnDefault("gen_random_uuid()")
  @Column(name = "dtct_mst_uuid", nullable = false)
  private UUID dtctMstUuid = UUID.randomUUID();

  @Size(max = 4)
  @NotNull
  @Column(name = "cprs_bf_yr", nullable = false, length = 4)
  private String cprsBfYr;

  @Size(max = 4)
  @NotNull
  @Column(name = "cprs_ad_yr", nullable = false, length = 4)
  private String cprsAdYr;

  @NotNull
  @Column(name = "dtct_sno", nullable = false)
  private Integer dtctSno;

  @NotNull
  @Column(name = "path_nm", nullable = false, length = Integer.MAX_VALUE)
  private String pathNm;

  @Size(max = 50)
  @Column(name = "feature_id", length = 50)
  private String featureId;

  @Size(max = 30)
  @NotNull
  @Column(name = "crt_epno", nullable = false, length = 30)
  private String crtEpno;

  @Size(max = 45)
  @NotNull
  @Column(name = "crt_ip", nullable = false, length = 45)
  private String crtIp;

  @NotNull
  @ColumnDefault("now()")
  @Column(name = "crt_dttm", nullable = false)
  private ZonedDateTime crtDttm = ZonedDateTime.now();

  @Size(max = 30)
  @Column(name = "chg_epno", length = 30)
  private String chgEpno;

  @Size(max = 45)
  @Column(name = "chg_ip", length = 45)
  private String chgIp;

  @Column(name = "chg_dttm")
  private ZonedDateTime chgDttm;
}
