from fastapi import FastAPI, Request
from pydantic import BaseModel
from commandManager import CommandManager

app = FastAPI()

# Modelo para recibir la orden
class OrderRequest(BaseModel):
	order: dict

# Instancia global del CommandManager
manager = CommandManager()

@app.post("/distribute")
async def distribute_order(order_request: OrderRequest):
	# order_request.order es un dict de productos: cantidad
	distribution = manager.distributor.distribute_single_order(order_request.order)
	return {"distribution": distribution}
