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

// Mock specific internal function call or just test the logic directly?
// Since we want to test what the AI *generated* from a prompt, we need the real AI response.
// But calling the AI costs money/time. 
// Let's first test if the regex handles the reported string correctly.
// If regex works, then the AI string must be different than I assumed.

function testSanitization(input) {
    // NUCLEAR STRATEGY:
    // 1. Replace known keywords with space
    let temp = input.replace(/(cek|traffic|trafik|status|info)/gi, ' ');
    // 2. Remove non-interface characters (allow alphanumeric, dash, dot, underscore, and space)
    // Actually, Mikrotik interfaces can have comments in names, but usually we search by 'name'.
    // Let's just try to split by space and take the first non-empty token.

    let tokens = temp.split(/\s+/).filter(t => t.length > 0);
    let cleanName = tokens.length > 0 ? tokens[0] : input;

    // Remove quotes just in case
    cleanName = cleanName.replace(/^["']|["']$/g, '');
    console.log(`Sanitized: '${cleanName}'`);
}

// Case 1: The reported "recursion"
testSanitization("vlan111cek traffic vlan111");

// Case 2: Standard
testSanitization("cek traffic vlan111");

// Case 3: Recursion with spaces?
testSanitization("vlan111 cek traffic vlan111");

// Case 4: No separator
testSanitization("vlan111cek traffic");
