<?php
/**
 * UPI Pool Daily Reset Cron
 * Run this at midnight every day to reset UPI daily usage
 * 
 * Add to crontab:
 * 0 0 * * * /usr/bin/php /path/to/crons/reset_upi_daily_usage.php
 */

require_once('../database/config.php');
require_once('../database/UpiPoolManager.php');

$upiManager = new UpiPoolManager($conn);

// Reset daily usage
$result = $upiManager->resetDailyUsage();

if ($result) {
    echo date('Y-m-d H:i:s') . " - UPI daily usage reset successfully\n";
    
    // Log to file
    $logFile = __DIR__ . '/upi_reset.log';
    file_put_contents($logFile, date('Y-m-d H:i:s') . " - Daily usage reset\n", FILE_APPEND);
} else {
    echo date('Y-m-d H:i:s') . " - Failed to reset UPI daily usage\n";
}
?>
