import { NextRequest, NextResponse } from 'next/server' import { automationService } from '../../../../lib/automation-service-simple' export async function GET(request: NextRequest) { try { console.log('๐Ÿงช Testing Automation Service Connection...') // Test configuration const testConfig = { userId: 'test-user-123', mode: 'SIMULATION' as const, symbol: 'SOLUSD', timeframe: '1h', tradingAmount: 10, // $10 for simulation maxLeverage: 2, stopLossPercent: 2, takeProfitPercent: 6, maxDailyTrades: 5, riskPercentage: 1 } console.log('๐Ÿ“‹ Config:', testConfig) // Test starting automation console.log('\n๐Ÿš€ Starting automation...') const startResult = await automationService.startAutomation(testConfig) console.log('โœ… Start result:', startResult) // Test getting status console.log('\n๐Ÿ“Š Getting status...') const status = await automationService.getStatus() console.log('โœ… Status:', status) // Test getting learning insights console.log('\n๐Ÿง  Getting learning insights...') const insights = await automationService.getLearningInsights(testConfig.userId) console.log('โœ… Learning insights:', insights) // Test stopping console.log('\n๐Ÿ›‘ Stopping automation...') const stopResult = await automationService.stopAutomation() console.log('โœ… Stop result:', stopResult) console.log('\n๐ŸŽ‰ All automation tests passed!') return NextResponse.json({ success: true, message: 'Automation service connection test passed!', results: { startResult, status, insights, stopResult } }) } catch (error) { console.error('โŒ Test failed:', error) return NextResponse.json({ success: false, error: error instanceof Error ? error.message : 'Unknown error' }, { status: 500 }) } }