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

import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.locationtech.jts.geom.Geometry;

public class ChangeDetectionDto {

  @Schema(name = "TestDto", description = "테스트용")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class TestDto {

    private Long id;
    private Geometry polygon;
    private Double centroidX;
    private Double centroidY;
  }

  @Schema(name = "CountDto", description = "분류별 탐지 건수")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class CountDto {

    private String classCd; // 영문코드
    private String className; // 한글명
    private Long count; // 건수
  }

  @Schema(name = "CogUrlReq", description = "COG Url Req")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class CogUrlReq {

    private Integer beforeYear;
    private Integer afterYear;
    private String mapSheetNum;
  }

  @Schema(name = "CogUrlDto", description = "COG Url 정보")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class CogUrlDto {

    private String beforeCogUrl;
    private String afterCogUrl;
    private JsonNode bbox;
  }

  @Schema(name = "CogUrlDto", description = "COG Url 정보")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class CogUrlData {

    private String beforeCogUrl;
    private String afterCogUrl;
    private String bbox;
  }

  @Schema(name = "AnalYearList", description = "년도(차수) 목록")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class AnalYearList {

    private Long analUid;
    private String analTitle;
    private Integer beforeYear;
    private Integer afterYear;
    private String baseMapSheetNum;
  }

  @Schema(name = "MapSheetList", description = "년도에 해당하는 도엽 목록")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class MapSheetList {

    private String mapSheetNum;
    private String mapSheetName;
    private String alias;
  }

  @Schema(name = "PolygonFeatureList", description = "Geometry 리턴 객체")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class PolygonFeatureList {

    private String type;
    private List<PolygonFeature> features; // Point 값
  }

  @Schema(name = "PointFeatureList", description = "Geometry 리턴 객체")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class PointFeatureList {

    private String type;
    private List<PointFeature> features; // Point 값
  }

  @Schema(name = "PolygonFeature", description = "Geometry 리턴 객체")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class PolygonFeature {

    private String type;
    private JsonNode geometry; // after 분류
    private PolygonProperties properties; //
  }

  @Schema(name = "PolygonFeature", description = "Geometry 리턴 객체")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class PolygonQueryData {

    private String type;
    private String geometry; // geoJson String
    private Long geoUid;
    private Double area; // 면적
    private Integer beforeYear; // 기준년도
    private Double beforeConfidence; // 기준 신뢰도(확률)
    private String beforeClass; // 기준 분류
    private Integer afterYear; // 비교년도
    private Double afterConfidence; // 비교 신뢰도(확률)
    private String afterClass;
    private Double cdProb; // 탐지정확도
  }

  @Schema(name = "PointFeature", description = "Geometry 리턴 객체")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class PointQueryData {

    private String type;
    private String geometry; // point
    private PointProperties properties; // Point 정보
  }

  @Schema(name = "PointFeature", description = "Geometry 리턴 객체")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class PointFeature {

    private String type;
    private JsonNode geometry; // point
    private PointProperties properties; // Point 정보
  }

  @Schema(name = "PointProperties", description = "폴리곤 리턴 객체")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class PointProperties {

    private Long geoUid;
    private String classCd; // after 분류
  }

  @Schema(name = "PolygonProperties", description = "폴리곤 정보")
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  public static class PolygonProperties {

    private Long geoUid;
    private Double area; // 면적
    private Integer beforeYear; // 기준년도
    private Double beforeConfidence; // 기준 신뢰도(확률)
    private String beforeClass; // 기준 분류
    private Integer afterYear; // 비교년도
    private Double afterConfidence; // 비교 신뢰도(확률)
    private String afterClass; // 비교 분류
    private Double cdProb; // 탐지 정확도
  }
}
