import { NextResponse } from 'next/server'; import { simpleAutomation } from '@/lib/simple-automation'; export async function POST(request) { try { const config = await request.json(); console.log('🚀 AUTOMATION START: Received config:', JSON.stringify(config, null, 2)); const result = await simpleAutomation.start(config); if (result.success) { return NextResponse.json(result); } else { return NextResponse.json(result, { status: 400 }); } } catch (error) { console.error('Start automation error:', error); return NextResponse.json({ success: false, error: 'Internal server error', message: error.message }, { status: 500 }); } }