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


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/?_=1740219852952&timestamp=1740298492177#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E9%80%9A%E7%94%A8%E5%9C%BA%E6%99%AFOCR&api=rest%2F2.0%2Focr%2Fv1%2Fseal&method=post
 *
 *
 * {
 *     "result": [
 *         {
 *             "type": "circle",
 *             "major": {
 *                 "probability": 0.9997932911,
 *                 "words": "天津市新型防伪公章样章",
 *                 "flatten_image": "/9j/4AAQSkZJRgABAQKAAAQABAAD/2wBD...",
 *             },
 *             "probability": 0.9977103472,
 *             "minor": [
 *                 {
 *                     "probability": 0.9997858405,
 *                     "words": "1234567890123",
 *                     "flatten_image": "/9j/4AAQSkZJRgABAQAAAQAB...",
 *                 }
 *             ],
 *             "location": {
 *                 "top": 75,
 *                 "left": 96,
 *                 "width": 567,
 *                 "height": 577
 *             },
 *             "seal_image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wB...",
 *         }
 *     ],
 *     "result_num": 1,
 *     "log_id": "1893578355833440675"
 * }
 */
@NoArgsConstructor
@Data
public class BSealResp  extends BBaseResp {


    @JsonProperty("result")
    private List<ResultDTO> result;
    @JsonProperty("result_num")
    private Integer resultNum;
    @JsonProperty("log_id")
    private String logId;

    @NoArgsConstructor
    @Data
    public static class ResultDTO {
        /**
         * 	印章的类别，共有circle（圆章），ellipse（椭圆章），rectangle（方章）三种
         */
        @JsonProperty("type")
        private String type;
        /**
         * 	主字段内容，即章内上环弯曲文字
         */
        @JsonProperty("major")
        private MajorDTO major;
        @JsonProperty("probability")
        private Double probability;
        @JsonProperty("minor")
        private List<MinorDTO> minor;
        @JsonProperty("location")
        private LocationDTO location;
        @JsonProperty("seal_image")
        private String sealImage;

        @NoArgsConstructor
        @Data
        public static class MajorDTO {
            @JsonProperty("probability")
            private Double probability;
            @JsonProperty("words")
            private String words;
            @JsonProperty("flatten_image")
            private String flattenImage;
        }

        @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 MinorDTO {
            @JsonProperty("probability")
            private Double probability;
            @JsonProperty("words")
            private String words;
            @JsonProperty("flatten_image")
            private String flattenImage;
        }
    }
}
