# -*- coding: utf-8 -*-
"""
Created on Sat Apr 27 12:09:00 2024

@author: yqlim
"""
from pprint import pprint
import googlemaps

class GoogleMapsApi(object):
    def __init__(self, api_key: str) -> None:        
        self.client = googlemaps.Client(api_key)

    

if __name__ == '__main__':
    api_key = 'AIzaSyAonjh_tXYKUgSpqhKFZ8beYvQLMzyeuqk'
    maps = GoogleMapsApi(api_key)
    print(dir(maps.client))

    address = 'Generała Józefa Bema 2, 50-265 Wrocław, Poland'
    response = maps.client.geocode(address)
    
    geometry = response[0]['geometry']
    nearby_hotels = maps.client.places_nearby(
        location=(geometry['location']['lat'], geometry['location']['lng']),
        radius=10000,
        type='restaurant'
    )

    pprint(nearby_hotels)
    details = dict()
    for hotel in nearby_hotels['results']:

        print(hotel['name'], ': ' , hotel['place_id'])
    #     details[hotel['name']] = maps.client.place(place_id=hotel['place_id'])
    
    # pprint(details['Hotel HP Park Plaza'])


# 
#     place