// TODO 미사용시작
package com.kamco.cd.training.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.PrePersist;
import jakarta.persistence.Table;
import jakarta.validation.constraints.Size;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.UUID;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;

@Getter
@Setter
@Entity
@Table(name = "tb_model_mng")
public class ModelMngEntity {

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "model_uid", nullable = false)
  private Long id;

  @Column(name = "uuid", columnDefinition = "uuid", nullable = false, updatable = false)
  private UUID uuid;

  @Size(max = 100)
  @ColumnDefault("'NULL::character varying'")
  @Column(name = "model_nm", length = 100)
  private String modelNm;

  @Size(max = 64)
  @ColumnDefault("'NULL::character varying'")
  @Column(name = "model_cate", length = 64)
  private String modelCate;

  @Size(max = 255)
  @ColumnDefault("'NULL::character varying'")
  @Column(name = "model_path")
  private String modelPath;

  @Column(name = "created_dttm")
  private Instant createdDttm;

  @Column(name = "created_uid")
  private Long createdUid;

  @Column(name = "updated_dttm")
  private Instant updatedDttm;

  @Column(name = "updated_uid")
  private Long updatedUid;

  @Column(name = "start_dttm")
  private ZonedDateTime startDttm;

  @Column(name = "training_end_dttm")
  private ZonedDateTime trainingEndDttm;

  @Column(name = "test_end_dttm")
  private ZonedDateTime testEndDttm;

  @Column(name = "duration_dttm")
  private ZonedDateTime durationDttm;

  @Size(max = 50)
  @Column(name = "process_stage", length = 50)
  private String processStage;

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

  @ColumnDefault("false")
  @Column(name = "deleted")
  private Boolean deleted;

  @PrePersist
  public void prePersist() {
    if (this.uuid == null) {
      this.uuid = UUID.randomUUID();
    }
  }

  /** UUID 필드가 제대로 설정되었는지 확인 (디버그용) */
  public String getUuidString() {
    return this.uuid != null ? this.uuid.toString() : null;
  }
}
// TODO 미사용 끝
