// TODO 미사용시작
package com.kamco.cd.training.dataset.dto;

import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import java.time.ZonedDateTime;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

public class MapSheetDto {

  @Schema(name = "MapSheet Basic", description = "도엽 기본 정보")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class Basic {

    private Long id;
    private Long datasetId;
    private String sheetNum;
    private String fileName;
    private Long fileSize;
    private String filePath;
    private String status;
    private String memo;
    private Boolean deleted;

    @JsonFormatDttm private ZonedDateTime createdDttm;

    @JsonFormatDttm private ZonedDateTime updatedDttm;
  }

  @Schema(name = "MapSheetSearchReq", description = "도엽 목록 조회 요청")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class SearchReq {

    @NotNull(message = "데이터셋 ID는 필수입니다")
    @Schema(description = "데이터셋 ID", example = "101")
    private Long datasetId;

    @Schema(description = "페이지 번호 (1부터 시작)", example = "1")
    private int page = 1;

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

    public Pageable toPageable() {
      int pageIndex = Math.max(0, page - 1);
      return PageRequest.of(pageIndex, size, Sort.by(Sort.Direction.DESC, "createdDttm"));
    }
  }

  @Schema(name = "MapSheetDeleteReq", description = "도엽 삭제 요청 (다건)")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class DeleteReq {

    @NotNull(message = "삭제할 도엽 ID 목록은 필수입니다")
    @Schema(description = "삭제할 도엽 ID 목록", example = "[9991, 9992]")
    private List<Long> itemIds;
  }

  // TODO 미사용시작
  @Schema(name = "MapSheetCheckReq", description = "도엽 번호 유효성 검증 요청")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class CheckReq {

    @NotNull(message = "도엽 번호는 필수입니다")
    @Schema(description = "도엽 번호", example = "377055")
    private String sheetNum;
  }

  @Schema(name = "MapSheetCheckRes", description = "도엽 번호 유효성 검증 응답")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class CheckRes {

    @Schema(description = "유효 여부", example = "true")
    private boolean valid;

    @Schema(description = "메시지", example = "유효한 도엽 번호입니다")
    private String message;

    @Schema(description = "중복 여부", example = "false")
    private boolean duplicate;
  }
}
// TODO 미사용 끝
