import axios from 'axios';
import { RequestBase } from './base';
export class AmapPOIRequest extends RequestBase {
  searchByKey(params) {
    throw new Error('Method not implemented.');
  }
  async searchByDistance(params) {
    try {
      const requestParams = {
        ...params,
        location: params.location.join(','),
        types: params.types?.join('|')
      };
      const {
        data
      } = await axios.get(`${this.serverHost}/place/around`, {
        params: requestParams
      });
      const {
        status,
        suggestion,
        pois,
        ...others
      } = data;
      return {
        ...others,
        status: Number(status),
        suggestion,
        pois: pois.map(poi => ({
          ...poi,
          location: poi.location.split(',').map(c => Number(c)),
          distance: Number(poi.distance),
          entrLocation: poi.entr_location?.split(',').map(c => Number(c)),
          exitLocation: poi.exit_location?.split(',').map(c => Number(c))
        }))
      };
    } catch (err) {
      return {
        status: 0,
        info: err.toString()
      };
    }
  }
  searchByPolygon(params) {
    throw new Error('Method not implemented.');
  }
  searchByID(params) {
    throw new Error('Method not implemented.');
  }
}
//# sourceMappingURL=poi.js.map