declare namespace AMap {
  namespace Geocoder {
    interface Options {
      city?: string
      radius?: number
      lang?: string
      batch?: boolean
      extensions?: 'base' | 'all'
    }

    interface Geocode {
      addressComponent: AddressComponent
      formattedAddress: string
      location: LngLat
      adcode: string
      level: string
    }

    interface GeocodeResult {
      info: string
      geocodes: Geocode[]
      resultNum: number
    }

    interface ReGeocodePoi {
      id: string
      name: string
      type: string
      tel: string
      distance: number
      direction: string
      address: string
      location: LngLat
      businessArea: string
    }

    interface ReGeocode {
      addressComponent: AddressComponent
      formattedAddress: string
      roads: Road[]
      crosses: Cross[]
      pois: ReGeocodePoi[]
    }

    interface ReGeocodeResult {
      info: string
      regeocode: ReGeocode
    }
  }

  interface Geocoder {
    new (options?: Geocoder.Options): Geocoder

    setCity(city: string): void
    getLocation(
      address: String,
      callback: (status: string, result: Geocoder.GeocodeResult) => any
    ): void
    getAddress(
      location: LngLat | LngLat[],
      callback: (status: string, result: Geocoder.ReGeocodeResult) => any
    ): void
  }
}
