package ru.soune.nocopy.dto.file;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoogleVisionSearchResponse {

    @JsonProperty("bestGuessLabels")
    private List<BestGuessLabel> bestGuessLabels;

    @JsonProperty("fullMatchingImages")
    private List<ImageResult> fullMatchingImages;

    @JsonProperty("visuallySimilarImages")
    private List<ImageResult> visuallySimilarImages;

    @JsonProperty("pagesWithMatchingImages")
    private List<PageResult> pagesWithMatchingImages;

    @JsonProperty("partialMatchingImages")
    private List<ImageResult> partialMatchingImages;

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class BestGuessLabel {
        @JsonProperty("label")
        private String label;

        @JsonProperty("languageCode")
        private String languageCode;
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class ImageResult {
        @JsonProperty("url")
        private String url;

        @JsonProperty("score")
        private Float score;

        @JsonProperty("height")
        private Integer height;

        @JsonProperty("width")
        private Integer width;
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class PageResult {
        @JsonProperty("url")
        private String url;

        @JsonProperty("pageTitle")
        private String pageTitle;

        @JsonProperty("fullMatchingImages")
        private List<ImageResult> fullMatchingImages;

        @JsonProperty("partialMatchingImages")
        private List<ImageResult> partialMatchingImages;
    }
}
