import { NextRequest, NextResponse } from 'next/server';
import { workflowEngine } from '@/lib/services/workflow-engine';

export async function POST(request: NextRequest) {
  try {
    const body = await request.json();
    const ticketId = body.ticket_id;

    if (!ticketId) {
      return NextResponse.json({ error: 'ticket_id is required' }, { status: 400 });
    }

    const result = await workflowEngine.dryRun(ticketId);
    return NextResponse.json(result);
  } catch (error) {
    console.error('Failed to run workflow test:', error);
    return NextResponse.json({ error: 'Failed to run workflow test' }, { status: 500 });
  }
}
