package com.usky.sas.service.dto.agbox;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.Data;

/**
 * AG 接口 getInfo 响应 - 地块详情（含地块和单位信息）
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class VillageInfoVO {

    private VillageInfoResult result;

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class VillageInfoResult {
        private VillageResultInfo village;
        private CompanyResultInfo company;
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class VillageResultInfo {
        private String villageCode;
        private String villageName;
        private String address;
        private Long provinceCode;
        private Long cityCode;
        private Long districtCode;
        private Long streetCode;
        private String roadCode;
        private String policeStationCode;
        /** gis 可能为字符串或 GeoJSON 对象 */
        private JsonNode gis;

        public String getGisAsString() {
            if (gis == null) return null;
            return gis.isTextual() ? gis.asText() : gis.toString();
        }
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class CompanyResultInfo {
        private String companyCode;
        private String companyName;
        private Long provinceCode;
        private Long cityCode;
        private Long districtCode;
        private Long streetCode;
        private String roadCode;
        private String policeStationCode;
        private String address;
        /** gis 可能为字符串或 GeoJSON 对象 */
        private JsonNode gis;
    }
}
