from fastapi import FastAPI
from pydantic import BaseModel
from typing import Optional
from comfy_launcher import launch_comfy_server

app = FastAPI()

class LaunchRequest(BaseModel):
    version_id: Optional[str] = "90f77137-ba75-400d-870f-204c614ae8a3"
    server_type: Optional[str] = "medium"
    duration: Optional[int] = 3600

@app.post("/launch")
def launch(req: LaunchRequest):
    return launch_comfy_server(
        version_id=req.version_id,
        server_type=req.server_type,
        duration=req.duration
    )
