import { NextRequest, NextResponse } from 'next/server' import { enhancedScreenshotService } from '../../../lib/enhanced-screenshot-simple' export async function POST(req: NextRequest) { try { const { symbol, timeframe, layouts, credentials } = await req.json() if (!symbol) { return NextResponse.json({ error: 'Missing symbol' }, { status: 400 }) } console.log('Enhanced screenshot API called with:', { symbol, timeframe, layouts }) const config = { symbol, timeframe: timeframe || '240', layouts: layouts || ['ai', 'diy'], credentials } const screenshots = await enhancedScreenshotService.captureWithLogin(config) return NextResponse.json({ success: true, screenshots, message: `Captured ${screenshots.length} screenshot(s) for ${symbol} with layouts: ${layouts?.join(', ') || 'default'}` }) } catch (error: any) { console.error('Enhanced screenshot API error:', error) return NextResponse.json({ error: error.message, success: false }, { status: 500 }) } } export async function GET() { return NextResponse.json({ message: 'Enhanced Screenshot API', methods: ['POST'], example: { symbol: 'SOLUSD', timeframe: '240', layouts: ['ai', 'diy'] } }) }