import { HttpClient, httpClient } from '../core/http-client';
import { environment } from '../../environments/environment';

export class PlacesService {

  constructor(private http: HttpClient = httpClient) {}

  searchPlaces(input: string): Promise<any> {
    const url = environment.backendApiV2 + 'client/google_maps/1.0.0/get_places?query=' + encodeURIComponent(input);
    return this.http.get(url);
  }

  getPlaceDetails(placeId: string): Promise<any> {
    const url = environment.backendApiV2 + 'client/google_maps/1.0.0/get_place_details?place_id=' + encodeURIComponent(placeId);
    return this.http.get(url);
  }
}
