<?php
/**
 * Run SQL to add bank transaction SMS settings
 */

require_once 'config/database.php';

try {
    echo "Adding bank transaction SMS settings to database...\n\n";
    
    // Enable bank transaction notifications
    $stmt = $pdo->prepare("INSERT INTO settings (setting_key, setting_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)");
    $stmt->execute(['sms_send_bank_transaction_notifications', '1']);
    echo "✅ sms_send_bank_transaction_notifications = 1\n";
    
    // Add default bank transaction template
    $stmt = $pdo->prepare("INSERT INTO settings (setting_key, setting_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)");
    $stmt->execute(['non_musking_tpl_bank_transaction', 'Dear {name}, your bank transaction of ৳{paid_amount} has been successfully verified. Your current due is ৳{due_amount}. Thank you.']);
    echo "✅ non_musking_tpl_bank_transaction = template\n";
    
    // Add default bank transaction rejection template
    $stmt = $pdo->prepare("INSERT INTO settings (setting_key, setting_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)");
    $stmt->execute(['non_musking_tpl_bank_transaction_rejection', 'Dear {name}, your bank transaction of ৳{amount} with ID {transaction_id} has been rejected. Reason: {notes}. Please contact administration.']);
    echo "✅ non_musking_tpl_bank_transaction_rejection = template\n";
    
    echo "\n🎉 All bank transaction SMS settings have been added successfully!\n";
    echo "You can now verify bank transactions from https://zashof.com/fees/verify_bank_transactions.php\n";
    echo "and SMS notifications will be sent to students' phones.\n";
    
} catch (Exception $e) {
    echo "❌ Error: " . $e->getMessage() . "\n";
}