package com.kamco.cd.kamcoback.changedetection.service;

import com.fasterxml.jackson.databind.JsonNode;
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
import com.kamco.cd.kamcoback.postgres.core.ChangeDetectionCoreService;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class ChangeDetectionService {

  private final ChangeDetectionCoreService changeDetectionCoreService;

  public List<ChangeDetectionDto.TestDto> getPolygonToPoint() {
    return changeDetectionCoreService.getPolygonToPoint();
  }

  public List<JsonNode> getPolygonToJson() {
    return changeDetectionCoreService.getPolygonToJson();
  }

  public List<ChangeDetectionDto.CountDto> getChangeDetectionClassCount(
      Long id, String mapSheetNum) {
    return changeDetectionCoreService.getChangeDetectionClassCount(id, mapSheetNum);
  }

  public ChangeDetectionDto.CogUrlDto getChangeDetectionCogUrl(ChangeDetectionDto.CogUrlReq req) {
    return changeDetectionCoreService.getChangeDetectionCogUrl(req);
  }

  public List<ChangeDetectionDto.AnalYearList> getChangeDetectionYearList() {
    return changeDetectionCoreService.getChangeDetectionYearList();
  }

  public ChangeDetectionDto.PolygonFeatureList getChangeDetectionPolygonList(
      Long analUid, String mapSheetNum) {

    return changeDetectionCoreService.getChangeDetectionPolygonList(analUid, mapSheetNum);
  }

  // Geometry 객체 순환 참조 문제로 캐싱 불가
  public ChangeDetectionDto.PointFeatureList getChangeDetectionPointList(
      Long analUid, String mapSheetNum) {
    return changeDetectionCoreService.getChangeDetectionPointList(analUid, mapSheetNum);
  }

  public List<ChangeDetectionDto.MapSheetList> getChangeDetectionMapSheetList(Long analUid) {
    return changeDetectionCoreService.getChangeDetectionMapSheetList(analUid);
  }
}
