<?php
require('include/functions.php');
$flows = sb_flows_get();
echo "Total Flows: " . count($flows) . "\n";
$search_text = "سيقوم أحد الأطباء";

foreach ($flows as $flow) {
    $found = false;
    $raw = json_encode($flow, JSON_UNESCAPED_UNICODE);
    if (strpos($raw, $search_text) !== false) {
        echo "FOUND in Flow: " . $flow['name'] . "\n";
        // echo "Content: " . $raw . "\n";
        
        // Print Triggers
        if (isset($flow['steps'][0][0][0])) {
             echo "Triggers: " . json_encode($flow['steps'][0][0][0], JSON_UNESCAPED_UNICODE) . "\n";  
        }
    }
}
?>
