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.SequenceGenerator;
import jakarta.persistence.Table;
import jakarta.validation.constraints.Size;
import java.time.ZonedDateTime;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;

@Getter
@Setter
@Entity
@Table(name = "tb_map_sheet_anal")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
// TODO SETTER 제거
// TODO 주석
public class MapSheetAnalEntity {

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

  // TODO UUID
  // UK 추가

  @Column(name = "compare_yyyy")
  private Integer compareYyyy; // 비교년도

  @Column(name = "target_yyyy")
  private Integer targetYyyy; // 기분년도

  @Column(name = "model_uid")
  private Long modelUid; // 모델식별키 ?

  @Size(max = 100)
  @Column(name = "server_ids", length = 100)
  private String serverIds; // 서버ID?

  @Column(name = "anal_map_sheet", length = Integer.MAX_VALUE)
  private String analMapSheet; // 분석도엽?

  @Column(name = "anal_strt_dttm")
  private ZonedDateTime analStrtDttm;

  @Column(name = "anal_end_dttm")
  private ZonedDateTime analEndDttm;

  @Column(name = "anal_sec")
  private Long analSec;

  @Column(name = "anal_pred_sec")
  private Long analPredSec; // 예상소요초?

  @Size(max = 20)
  @Column(name = "anal_state", length = 20)
  private String analState; // enum  으로 관리

  @Size(max = 20)
  @Column(name = "gukyuin_used", length = 20)
  private String gukyuinUsed; // Boolean으로 관리

  @Column(name = "accuracy")
  private Double accuracy;

  @Size(max = 255)
  @Column(name = "result_url")
  private String resultUrl;

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

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

  @Size(max = 255)
  @Column(name = "anal_title")
  private String analTitle;

  @Column(name = "detecting_cnt")
  private Long detectingCnt;

  @Column(name = "base_map_sheet_num")
  private String baseMapSheetNum;

  // TODO CommonDateEntity ?
  @ColumnDefault("now()")
  @Column(name = "created_dttm")
  private ZonedDateTime createdDttm;

  @ColumnDefault("now()")
  @Column(name = "updated_dttm")
  private ZonedDateTime updatedDttm;
}
