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

import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.ZonedDateTime;
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 MapSheetMngDto {

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

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

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

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

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

  @Schema(name = "MngDto", description = "영상관리 검색 리턴")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class MngDto {
    private int rowNum;
    private int mngYyyy;
    private String mngState;
    private String syncState;
    private String syncCheckState;
    private Long syncTotCnt;
    private Long syncStateDoneCnt;
    private Long syncCheckStateDoneCnt;
    private Long syncNotFileCnt;
    private Long syncTypeErrorCnt;
    private Long syncSizeErrorCnt;
    @JsonFormatDttm private ZonedDateTime rgstStrtDttm;
    @JsonFormatDttm private ZonedDateTime rgstEndDttm;
  }

  @Schema(name = "MngHstDto", description = "영상관리내역 검색 리턴")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class MngHstDto {
    private long hstUid;
    private int mngYyyy;
    private String mapSheetNum;
    private String refMapSheetNum;
    private String dataState;
    private String syncState;
    private String syncCheckState;
    @JsonFormatDttm private ZonedDateTime syncStrtDttm;
    @JsonFormatDttm private ZonedDateTime syncEndDttm;
    @JsonFormatDttm private ZonedDateTime syncCheckStrtDttm;
    @JsonFormatDttm private ZonedDateTime syncCheckEndDttm;

    private String syncMngPath;
  }

  @Schema(name = "MngFileAddReq", description = "영상관리파일 등록 요청")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class MngFileAddReq {
    private int mngYyyy;
    private String mapSheetNum;
    private String refMapSheetNum;
    private String filePath;
    private String fileName;
    private String fileExt;
    private Long hstUid;
    private Long fileSize;
    private String fileState;
  }

  @Schema(name = "MngFilesDto", description = "영상관리내역 검색 리턴")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class MngFilesDto {
    private long fileUid;
    private int mngYyyy;
    private String mapSheetNum;
    private String refMapSheetNum;
    private String filePath;
    private String fileName;
    private String fileExt;
    private Long hstUid;
    private Long fileSize;
  }

  @Schema(name = "DmlReturn", description = "영상관리 DML 수행 후 리턴")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class DmlReturn {
    private String flag;
    private String message;
  }
}
