import { AIClient } from '../src/services/aiClient.js';
import logger from '../src/utils/logger.js';
import * as dotenv from 'dotenv';

dotenv.config();

async function testAIFallback() {
    console.log("--- 🤖 TESTING AI MULTI-PROVIDER FALLBACK ---");

    const aiClient = new AIClient();
    const testPrompt = "Return a JSON object with action: HOLD, confidence: 50, reasoning: 'Test run'. JSON ONLY.";

    console.log("\nAttempting analysis with current configuration...");
    const result = await aiClient.generateAnalysis(testPrompt);

    if (result) {
        console.log("\n✅ SUCCESS! Received response:");
        console.log(result);
    } else {
        console.error("\n❌ FAILED! All providers in fallback list failed or were not configured.");
        console.log("Tip: Check your .env for AI_FALLBACK_LIST and respective API keys.");
    }

    console.log("\n--- ✨ TEST COMPLETE ---");
}

testAIFallback().catch(console.error);
