<?php
require('include/functions.php');
$flows = sb_flows_get();
echo "Active Flows Count: " . count($flows) . "\n";
foreach ($flows as $f) {
    echo "--- Flow: " . $f['name'] . " ---\n";
    // Check triggers
    if (isset($f['steps']) && isset($f['steps'][0])) {
         // Usually step 0 is the triggers container? No, steps[0][0][0] is active trigger check logic?
         // In sb_native_flow_run: $trigger_step = $flow['steps'][0][0][0];
         $step = $f['steps'][0][0][0];
         echo "Triggers: " . json_encode($step, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) . "\n";
    }
}

// Search for 'أسعار' in settings
echo "\nSearching 'أسعار' in sb_settings...\n";
$res = sb_db_get("SELECT name, value FROM sb_settings WHERE value LIKE '%أسعار%'", true); // Returns array of rows
if ($res && is_array($res)) {
    echo "Found " . count($res) . " rows.\n";
    foreach ($res as $r) {
        echo "Key: " . $r['name'] . "\n"; 
        // echo "Value: " . mb_substr($r['value'], 0, 100) . "...\n";
    }
}
?>
