<?php
// Database configuration
require_once '../config/database.php';

echo "Checking SMS settings in database...\n\n";

// Check all relevant settings
$settings = [
    'non_musking_enabled',
    'non_musking_username',
    'non_musking_password',
    'sms_send_bank_transaction_notifications',
    'non_musking_templates_bank_transaction',
    'non_musking_templates_bank_transaction_rejection'
];

foreach ($settings as $setting) {
    $stmt = $pdo->prepare("SELECT setting_value FROM settings WHERE setting_key = ?");
    $stmt->execute([$setting]);
    $result = $stmt->fetch();

    if ($result) {
        echo "$setting: " . $result['setting_value'] . "\n";
    } else {
        echo "$setting: NOT FOUND\n";
    }
}

echo "\nChecking if SMS helper functions exist...\n";

// Check if sms_helper.php exists and has the required functions
$smsHelperPath = '../includes/sms_helper.php';
if (file_exists($smsHelperPath)) {
    echo "sms_helper.php exists\n";
    $content = file_get_contents($smsHelperPath);
    
    $functions = ['non_musking_send_template', 'non_musking_send', 'sms_config'];
    foreach ($functions as $func) {
        if (strpos($content, $func) !== false) {
            echo "$func: FOUND\n";
        } else {
            echo "$func: NOT FOUND\n";
        }
    }
} else {
    echo "sms_helper.php: NOT FOUND\n";
}

echo "\nChecking config/sms.php file...\n";
$smsConfigPath = '../config/sms.php';
if (file_exists($smsConfigPath)) {
    echo "config/sms.php exists\n";
} else {
    echo "config/sms.php: NOT FOUND\n";
}
?>