import requests

API_URL = "http://127.0.0.1:8000"

class WaiterDataProvider:
    def __init__(self, api_url=API_URL):
        self.api_url = api_url

    def get_waiter_loads(self):
        """
        Devuelve dos listas: nombres de camareros y sus loads.
        """
        resp = requests.get(f"{self.api_url}/waiters")
        if resp.status_code == 200:
            waiters = resp.json()
            names = [w['name'] for w in waiters]
            loads = [w['load'] for w in waiters]
            return names, loads
        else:
            print("Error obteniendo camareros:", resp.status_code, resp.text)
            return [], []
