import requests

API_URL = "http://127.0.0.1:8000"
USERS = [
    {"username": "admin", "password": "admin123", "role": "admin"},
    {"username": "barra", "password": "barra123", "role": "barra"},
    {"username": "sala", "password": "sala123", "role": "sala"},
    {"username": "manager", "password": "manager123", "role": "manager"},
]

for user in USERS:
    resp = requests.post(f"{API_URL}/users/", json=user)
    if resp.status_code in (200, 201):
        print(f"Usuario creado: {user['username']} ({user['role']})")
    elif resp.status_code == 400 and "already registered" in resp.text:
        print(f"Usuario ya existía: {user['username']}")
    else:
        print(f"Error creando usuario {user['username']}: {resp.status_code} {resp.text}")
