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

import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
import jakarta.persistence.*;
import java.time.ZonedDateTime;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "tb_map_sheet_mng_hst")
public class MapSheetMngHstEntity extends CommonDateEntity {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "hst_uid")
  private Long hstUid;

  @Column(name = "mng_yyyy")
  private Integer mngYyyy;

  @Column(name = "map_sheet_code")
  private Integer mapSheetCode;

  @Column(name = "map_sheet_num")
  private String mapSheetNum;

  @Column(name = "map_sheet_name")
  private String mapSheetName;

  @Column(name = "map_sheet_code_src")
  private Integer mapSheetCodeSrc;

  @Column(name = "scale_ratio")
  private Integer scaleRatio;

  @Column(name = "data_state")
  @Enumerated(EnumType.STRING)
  private MapSheetMngDto.DataState dataState;

  @Column(name = "data_state_dttm")
  private ZonedDateTime dataStateDttm;

  @Column(name = "use_inference")
  private Boolean useInference;

  @Column(name = "use_inference_dttm")
  private ZonedDateTime useInferenceDttm;

  @Column(name = "map_sheet_path")
  private String mapSheetPath;

  @Column(name = "ref_map_sheet_num")
  private Long refMapSheetNum;

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

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

  public void updateDataState(MapSheetMngDto.DataState dataState) {
    this.dataState = dataState;
    this.dataStateDttm = ZonedDateTime.now();
  }

  public void updateUseInference(Boolean useInference) {
    this.useInference = useInference;
    this.useInferenceDttm = ZonedDateTime.now();
  }
}
