from fastapi import APIRouter, Request
from app.schemas.api import WorkflowRequest, WorkflowResponse
from app.services.workflow_service import run_arc_workflow

router = APIRouter(tags=["workflow"])


@router.post("/workflow/run", response_model=WorkflowResponse)
async def run_workflow(payload: WorkflowRequest, request: Request):
    qdrant_repo = request.app.state.qdrant_repo

    result = await run_arc_workflow(payload.model_dump(), qdrant_repo)
    
    return WorkflowResponse(**result)