require('dotenv').config();
const gemini = require('./gemini');

async function test() {
    console.log("Simulating Admin Chat: 'cek traffic valid_offline_user'...");

    // We are simulating a condition where:
    // 1. User 'valid_offline_user' exists in PPPoE Secrets (we assume this for the test or mock it)
    // 2. User does NOT exist in Active Interfaces.

    // NOTE: For this test to work against a REAL Mikrotik, we needs a real user name that is offline.
    // However, if we don't have one, we might get "Interface/User not found".
    // TO verify the logic properly without a real offline user, we would need to mock MikrotikService.
    // Given the constraints, I will try to use a common username pattern that might exist or just rely on the fallback if it doesn't.
    // Better yet, let's try to query a user we know DOESN'T exist to see the "Not Found" message, 
    // and if possible one that DOES to see "OFFLINE".

    // Let's rely on the previous "fake_interface_abc" which definitely doesn't exist to see "Not Found".
    // And for "Valid Offline", it's hard without knowing reliable data.
    // But I can at least verify the code PATH by seeing if it calls getPppoeSecret.

    // Example: "cek traffic <some_real_but_offline_user>"
    // I'll try with "user_123" assuming it might not be there, expecting "Not Found".

    const userMessage = "cek traffic valid_user_offline_123";
    const userName = "Admin";
    const isAdmin = true;

    const response = await gemini.generateResponse(
        userMessage,
        userName,
        null,
        null,
        isAdmin
    );

    console.log("\nFinal Response:\n", response);
}

test();
