from fastapi import APIRouter, Request
from fastapi.templating import Jinja2Templates
from fastapi.responses import HTMLResponse

router = APIRouter()
templates = Jinja2Templates(directory="app")

@router.get("/devportal", response_class=HTMLResponse)
async def devportal_dashboard(request: Request):
    """Render the DEV Portal dashboard"""
    return templates.TemplateResponse("devportal/frontend/portal.html", {"request": request})

@router.get("/devportal/editor", response_class=HTMLResponse)
async def workflow_editor(request: Request, id: int = None):
    """Render the workflow editor with draw.io integration"""
    return templates.TemplateResponse("devportal/frontend/editor.html", {
        "request": request,
        "workflow_id": id
    })
