/// <reference path="controls/index.d.ts" />
/// <reference path="services/index.d.ts" />
/// <reference path="district-layer/index.d.ts" />
/// <reference path="tools/index.d.ts" />

declare namespace AMap {
  interface Map extends Record<string, any> {
    $vm?: Vue
  }

  function plugin(plugins: string | string[], cb: Function): void

  type AMapGlobal = typeof AMap & {
    PlaceSearch: AMap.PlaceSearch
    Autocomplete: AMap.Autocomplete
    CitySearch: AMap.CitySearch
    Geocoder: AMap.Geocoder
    Geolocation: AMap.Geolocation

    Scale: AMap.Scale
    ControlBar: AMap.ControlBar
    MapType: AMap.MapType
    OverView: AMap.OverView
    ToolBar: AMap.ToolBar

    MarkerClusterer: AMap.MarkerClusterer
    MouseTool: AMap.MouseTool

    DistrictLayer: {
      World: AMap.DistrictLayer.World
      Country: AMap.DistrictLayer.Country
      Province: AMap.DistrictLayer.Province
    }
  } & Record<string, any>

  interface Bounds {
    path?: number[][] // 3D地图的边界是个多边形
  }

  type Component = (Layer | Overlay | Control | Tool) &
    AMap.EventEmitter &
    Record<string, any> & {
      $vm?: Vue
    }
}
