package com.kamco.cd.kamcoback.mapsheet.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import java.time.ZonedDateTime;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

public class ImageryDto {

  @Schema(name = "searchReq", description = "영상관리 Sync대상 검색 요청")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class searchReq {

    // 페이징 파라미터
    @Schema(description = "페이지 번호 (0부터 시작) ", example = "0")
    @NotNull
    private int page = 0;

    @Schema(description = "페이지 크기", example = "20000")
    @NotNull
    private int size = 20000;

    @Schema(description = "정렬", example = "id desc")
    private String sort;

    @Schema(description = "검색어(36809 또는 36809010)", example = "36809010")
    private String searchValue;

    @Schema(description = "년도", example = "2025")
    @NotNull
    private Integer mngYyyy;

    public Pageable toPageable() {
      return PageRequest.of(page, size);
    }
  }

  @Schema(name = "ImageryDto", description = "영상관리파일 검색 리턴")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class BasicDto {
    private Long id;
    private UUID uuid;
    private Integer year;
    private String scene50k;
    private String scene5k;
    private Integer sceneId50k;
    private Integer sceneId5k;
    private ZonedDateTime createdDate;
    private String middlePath;
    private String cogMiddlePath;
    private String filename;
    private String cogFilename;
  }

  @Schema(name = "ImagerySyncDto", description = "영상싱크파일 검색 리턴")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class SyncDto {
    private Long id;
    private Integer year;
    private String scene50k;
    private String scene5k;
    private String middlePath;
    private String cogMiddlePath;
    private String filename;
    private String cogFilename;
    private Long hstUid;
  }

  @Schema(name = "SyncReturn", description = "영상파일싱크 수행 후 리턴")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class SyncReturn {
    private String flag;
    private int syncCnt;
    private int tfwErrCnt;
    private int tifErrCnt;
  }
}
