package com.kamco.cd.kamcoback.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.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;
import org.locationtech.jts.geom.Geometry;

@Getter
@Setter
@Entity
@Table(name = "inference_results")
public class InferenceResultEntity {

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

  @NotNull
  @ColumnDefault("uuid_generate_v4()")
  @Column(name = "uuid", nullable = false)
  private UUID uuid;

  @Column(name = "stage")
  private Integer stage;

  @Column(name = "cd_prob")
  private Float cdProb;

  @Column(name = "input1")
  private Integer input1;

  @Column(name = "input2")
  private Integer input2;

  @Column(name = "map_id")
  private Long mapId;

  @Size(max = 20)
  @Column(name = "before_class", length = 20)
  private String beforeClass;

  @Column(name = "before_probability")
  private Float beforeProbability;

  @Size(max = 20)
  @Column(name = "after_class", length = 20)
  private String afterClass;

  @Column(name = "after_probability")
  private Float afterProbability;

  @ColumnDefault("st_area(geometry)")
  @Column(name = "area")
  private Float area;

  @NotNull
  @ColumnDefault("now()")
  @Column(name = "created_dttm", nullable = false)
  private ZonedDateTime createdDttm;

  @NotNull
  @ColumnDefault("now()")
  @Column(name = "updated_dttm", nullable = false)
  private ZonedDateTime updatedDttm;

  @Column(name = "geometry", columnDefinition = "geometry not null")
  private Geometry geometry;
}
