// TODO 미사용시작
package com.kamco.cd.training.postgres.entity;

import com.kamco.cd.training.dataset.dto.MapSheetDto;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.ZonedDateTime;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;

@Getter
@Setter
@Entity
@Table(name = "tb_map_sheet")
public class MapSheetEntity {

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

  @NotNull
  @Column(name = "object_id", nullable = false)
  private Long objectId;

  @NotNull
  @Column(name = "dataset_id", nullable = false)
  private Long datasetId;

  @NotNull
  @Size(max = 20)
  @Column(name = "sheet_num", nullable = false, length = 20)
  private String sheetNum;

  @Size(max = 255)
  @Column(name = "file_name", length = 255)
  private String fileName;

  @Column(name = "file_size")
  private Long fileSize;

  @Size(max = 500)
  @Column(name = "file_path", length = 500)
  private String filePath;

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

  @Column(name = "memo", columnDefinition = "TEXT")
  private String memo;

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

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

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

  @Column(name = "map_id_cd_no")
  private Long mapIdCdNo;

  @Size(max = 128)
  @Column(name = "map_id_nm", length = 128)
  private String mapIdNm;

  @Size(max = 128)
  @Column(name = "shape_leng", length = 128)
  private String shapeLeng;

  @Column(name = "shape_area")
  private Double shapeArea;

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

  @Column(name = "wkt_geom", columnDefinition = "TEXT")
  private String wktGeom;

  @Column(name = "ref_map_id_cd_no")
  private Long refMapIdCdNo;

  public MapSheetDto.Basic toDto() {
    MapSheetDto.Basic dto = new MapSheetDto.Basic();
    dto.setId(this.id);
    dto.setDatasetId(this.datasetId);
    dto.setSheetNum(this.sheetNum);
    dto.setFileName(this.fileName);
    dto.setFileSize(this.fileSize);
    dto.setFilePath(this.filePath);
    dto.setStatus(this.status);
    dto.setMemo(this.memo);
    dto.setDeleted(this.deleted);
    dto.setCreatedDttm(this.createdDttm);
    dto.setUpdatedDttm(this.updatedDttm);
    return dto;
  }
}
// TODO 미사용 끝
