package com.heyu.api.baidu.response.educational;


import com.fasterxml.jackson.annotation.JsonProperty;
import com.heyu.api.baidu.response.BBaseResp;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/***
 * https://console.bce.baidu.com/support/?_=1740575657628&timestamp=1740583045120#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E6%95%99%E8%82%B2%E5%9C%BA%E6%99%AFOCR&api=rest%2F2.0%2Focr%2Fv1%2Fdoc_analysis&method=post
 *
 *试卷分析与识别
 */
@NoArgsConstructor
@Data
public class BDocAnalysisResp extends BBaseResp {


    @JsonProperty("results_num")
    private Integer resultsNum;
    @JsonProperty("log_id")
    private String logId;
    @JsonProperty("img_direction")
    private Integer imgDirection;
    @JsonProperty("layouts_num")
    private Integer layoutsNum;
    @JsonProperty("results")
    private List<ResultsDTO> results;
    @JsonProperty("formula_result")
    private List<FormulaResultDTO> formulaResult;
    @JsonProperty("words_result")
    private List<WordsResultDTO> wordsResult;

    @NoArgsConstructor
    @Data
    public static class ResultsDTO {
        @JsonProperty("words_type")
        private String wordsType;
        @JsonProperty("words")
        private WordsDTO words;

        @NoArgsConstructor
        @Data
        public static class WordsDTO {
            @JsonProperty("words_location")
            private WordsLocationDTO wordsLocation;
            @JsonProperty("word")
            private String word;

            @NoArgsConstructor
            @Data
            public static class WordsLocationDTO {
                @JsonProperty("top")
                private Integer top;
                @JsonProperty("left")
                private Integer left;
                @JsonProperty("width")
                private Integer width;
                @JsonProperty("height")
                private Integer height;
            }
        }
    }

    @NoArgsConstructor
    @Data
    public static class FormulaResultDTO {
        @JsonProperty("form_location")
        private FormLocationDTO formLocation;
        @JsonProperty("form_words")
        private String formWords;

        @NoArgsConstructor
        @Data
        public static class FormLocationDTO {
            @JsonProperty("top")
            private Integer top;
            @JsonProperty("left")
            private Integer left;
            @JsonProperty("width")
            private Integer width;
            @JsonProperty("height")
            private Integer height;
        }
    }

    @NoArgsConstructor
    @Data
    public static class WordsResultDTO {
        @JsonProperty("location")
        private LocationDTO location;
        @JsonProperty("words")
        private String words;

        @NoArgsConstructor
        @Data
        public static class LocationDTO {
            @JsonProperty("top")
            private Integer top;
            @JsonProperty("left")
            private Integer left;
            @JsonProperty("width")
            private Integer width;
            @JsonProperty("height")
            private Integer height;
        }
    }
}
