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

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * {
 *     "paragraphs_result": [
 *         {
 *             "words_result_idx": [
 *                 0
 *             ],
 *             "finegrained_vertexes_location": [
 *                 {
 *                     "x": 36,
 *                     "y": 18
 *                 }
 *             ],
 *             "min_finegrained_vertexes_location": [
 *                 {
 *                     "x": 36,
 *                     "y": 18
 *                 },
 *
 *             ]
 *         },
 *         {
 *             "words_result_idx": [
 *                 1,
 *                 2
 *             ],
 *             "finegrained_vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 66
 *                 }
 *             ],
 *             "min_finegrained_vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 66
 *                 },
 *                 {
 *                     "x": 1147,
 *                     "y": 66
 *                 },
 *                 {
 *                     "x": 1147,
 *                     "y": 133
 *                 },
 *                 {
 *                     "x": 35,
 *                     "y": 133
 *                 }
 *             ]
 *         },
 *         {
 *             "words_result_idx": [
 *                 3
 *             ],
 *             "finegrained_vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 159
 *                 }
 *             ],
 *             "min_finegrained_vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 159
 *                 }
 *             ]
 *         },
 *         {
 *             "words_result_idx": [
 *                 4
 *             ],
 *             "finegrained_vertexes_location": [
 *                 {
 *                     "x": 522,
 *                     "y": 238
 *                 }
 *             ],
 *             "min_finegrained_vertexes_location": [
 *                 {
 *                     "x": 522,
 *                     "y": 238
 *                 },
 *                 {
 *                     "x": 663,
 *                     "y": 238
 *                 },
 *                 {
 *                     "x": 663,
 *                     "y": 265
 *                 },
 *                 {
 *                     "x": 522,
 *                     "y": 265
 *                 }
 *             ]
 *         }
 *     ],
 *     "paragraphs_result_num": 4,
 *     "words_result": [
 *         {
 *             "vertexes_location": [
 *                 {
 *                     "x": 36,
 *                     "y": 18
 *                 },
 *                 {
 *                     "x": 489,
 *                     "y": 18
 *                 },
 *                 {
 *                     "x": 489,
 *                     "y": 47
 *                 },
 *                 {
 *                     "x": 36,
 *                     "y": 47
 *                 }
 *             ],
 *             "probability": {
 *                 "average": 0.9940845966,
 *                 "min": 0.9428667426,
 *                 "variance": 0.0001961153466
 *             },
 *             "finegrained_vertexes_location": [
 *                 {
 *                     "x": 36,
 *                     "y": 18
 *                 }
 *             ],
 *             "words": "怀宁：农文旅融合绘就乡村新图景",
 *             "location": {
 *                 "top": 18,
 *                 "left": 36,
 *                 "width": 452,
 *                 "height": 29
 *             },
 *             "min_finegrained_vertexes_location": [
 *                 {
 *                     "x": 36,
 *                     "y": 18
 *                 }
 *             ]
 *         },
 *         {
 *             "vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 66
 *                 }
 *             ],
 *             "probability": {
 *                 "average": 0.9931491613,
 *                 "min": 0.8187180161,
 *                 "variance": 0.0008177412092
 *             },
 *             "finegrained_vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 66
 *                 }
 *             ],
 *             "words": "怀宁：农文旅融合绘就乡村新图景-在雷埠乡曙光村迎庆桃基地，村民们正在学习果树修枝、追肥、病",
 *             "location": {
 *                 "top": 66,
 *                 "left": 35,
 *                 "width": 1113,
 *                 "height": 27
 *             },
 *             "min_finegrained_vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 66
 *                 }
 *             ]
 *         },
 *         {
 *             "vertexes_location": [
 *                 {
 *                     "x": 38,
 *                     "y": 110
 *                 },
 *                 {
 *                     "x": 277,
 *                     "y": 110
 *                 },
 *                 {
 *                     "x": 277,
 *                     "y": 134
 *                 },
 *                 {
 *                     "x": 38,
 *                     "y": 134
 *                 }
 *             ],
 *             "probability": {
 *                 "average": 0.9991052747,
 *                 "min": 0.9977212548,
 *                 "variance": 5.986859719e-7
 *             },
 *             "finegrained_vertexes_location": [
 *                 {
 *                     "x": 37,
 *                     "y": 110
 *                 }
 *             ],
 *             "words": "虫害防治等田管技术。",
 *             "location": {
 *                 "top": 110,
 *                 "left": 37,
 *                 "width": 239,
 *                 "height": 23
 *             },
 *             "min_finegrained_vertexes_location": [
 *                 {
 *                     "x": 37,
 *                     "y": 110
 *                 },
 *                 {
 *                     "x": 276,
 *                     "y": 110
 *                 },
 *                 {
 *                     "x": 276,
 *                     "y": 133
 *                 },
 *                 {
 *                     "x": 37,
 *                     "y": 133
 *                 }
 *             ]
 *         },
 *         {
 *             "vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 160
 *                 },
 *                 {
 *                     "x": 322,
 *                     "y": 160
 *                 },
 *                 {
 *                     "x": 322,
 *                     "y": 187
 *                 },
 *                 {
 *                     "x": 35,
 *                     "y": 187
 *                 }
 *             ],
 *             "probability": {
 *                 "average": 0.9929791093,
 *                 "min": 0.9341663122,
 *                 "variance": 0.000318855542
 *             },
 *             "finegrained_vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 159
 *                 }
 *             ],
 *             "words": "新华网安徽站前天16：47",
 *             "location": {
 *                 "top": 159,
 *                 "left": 35,
 *                 "width": 286,
 *                 "height": 27
 *             },
 *             "min_finegrained_vertexes_location": [
 *                 {
 *                     "x": 35,
 *                     "y": 159
 *                 },
 *                 {
 *                     "x": 321,
 *                     "y": 159
 *                 },
 *                 {
 *                     "x": 321,
 *                     "y": 185
 *                 },
 *                 {
 *                     "x": 35,
 *                     "y": 185
 *                 }
 *             ]
 *         },
 *         {
 *             "vertexes_location": [
 *                 {
 *                     "x": 523,
 *                     "y": 239
 *                 },
 *                 {
 *                     "x": 665,
 *                     "y": 239
 *                 },
 *                 {
 *                     "x": 665,
 *                     "y": 267
 *                 },
 *                 {
 *                     "x": 523,
 *                     "y": 267
 *                 }
 *             ],
 *             "probability": {
 *                 "average": 0.9067940712,
 *                 "min": 0.539375782,
 *                 "variance": 0.0337520726
 *             },
 *             "finegrained_vertexes_location": [
 *                 {
 *                     "x": 522,
 *                     "y": 238
 *                 }
 *             ],
 *             "words": "查看更多>",
 *             "location": {
 *                 "top": 238,
 *                 "left": 522,
 *                 "width": 141,
 *                 "height": 28
 *             },
 *             "min_finegrained_vertexes_location": [
 *                 {
 *                     "x": 522,
 *                     "y": 238
 *                 },
 *                 {
 *                     "x": 663,
 *                     "y": 238
 *                 },
 *                 {
 *                     "x": 663,
 *                     "y": 265
 *                 },
 *                 {
 *                     "x": 522,
 *                     "y": 265
 *                 }
 *             ]
 *         }
 *     ],
 *     "direction": 0,
 *     "language": 3,
 *     "words_result_num": 5,
 *     "log_id": "1893530695807231276"
 * }
 */
@NoArgsConstructor
@Data
public class BGeneralResp {


    @JsonProperty("paragraphs_result")
    private List<ParagraphsResultDTO> paragraphsResult;
    @JsonProperty("paragraphs_result_num")
    private Integer paragraphsResultNum;
    @JsonProperty("words_result")
    private List<WordsResultDTO> wordsResult;
    @JsonProperty("direction")
    private Integer direction;
    @JsonProperty("language")
    private Integer language;
    @JsonProperty("words_result_num")
    private Integer wordsResultNum;
    @JsonProperty("log_id")
    private String logId;

    @NoArgsConstructor
    @Data
    public static class ParagraphsResultDTO {
        @JsonProperty("words_result_idx")
        private List<Integer> wordsResultIdx;
        @JsonProperty("finegrained_vertexes_location")
        private List<FinegrainedVertexesLocationDTO> finegrainedVertexesLocation;
        @JsonProperty("min_finegrained_vertexes_location")
        private List<MinFinegrainedVertexesLocationDTO> minFinegrainedVertexesLocation;

        @NoArgsConstructor
        @Data
        public static class FinegrainedVertexesLocationDTO {
            @JsonProperty("x")
            private Integer x;
            @JsonProperty("y")
            private Integer y;
        }

        @NoArgsConstructor
        @Data
        public static class MinFinegrainedVertexesLocationDTO {
            @JsonProperty("x")
            private Integer x;
            @JsonProperty("y")
            private Integer y;
        }
    }

    @NoArgsConstructor
    @Data
    public static class WordsResultDTO {
        @JsonProperty("vertexes_location")
        private List<VertexesLocationDTO> vertexesLocation;
        @JsonProperty("probability")
        private ProbabilityDTO probability;
        @JsonProperty("finegrained_vertexes_location")
        private List<FinegrainedVertexesLocationDTO> finegrainedVertexesLocation;
        @JsonProperty("words")
        private String words;
        @JsonProperty("location")
        private LocationDTO location;
        @JsonProperty("min_finegrained_vertexes_location")
        private List<MinFinegrainedVertexesLocationDTO> minFinegrainedVertexesLocation;

        @NoArgsConstructor
        @Data
        public static class ProbabilityDTO {
            @JsonProperty("average")
            private Double average;
            @JsonProperty("min")
            private Double min;
            @JsonProperty("variance")
            private Double variance;
        }

        @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;
        }

        @NoArgsConstructor
        @Data
        public static class VertexesLocationDTO {
            @JsonProperty("x")
            private Integer x;
            @JsonProperty("y")
            private Integer y;
        }

        @NoArgsConstructor
        @Data
        public static class FinegrainedVertexesLocationDTO {
            @JsonProperty("x")
            private Integer x;
            @JsonProperty("y")
            private Integer y;
        }

        @NoArgsConstructor
        @Data
        public static class MinFinegrainedVertexesLocationDTO {
            @JsonProperty("x")
            private Integer x;
            @JsonProperty("y")
            private Integer y;
        }
    }
}
