<?php

namespace App\Controllers;

use App\Controllers\BaseController;

class Cron extends BaseController
{
    public function index()
    {
        return "Cron Controller";
    }

    // Run via: php public/index.php cron processQueue
    // Or URL: https://yourdomain.com/cron/processQueue (Secure this!)
    public function processQueue()
    {
        // 1. Fetch pending notifications from DB
        // 2. Send via FCM
        // 3. Mark as sent
        
        log_message('info', 'Cron: Processing Queue...');
        
        // Mock processing
        // $notificationModel->where('status', 'pending')->findAll();
        // ...
        
        return "Queue Processed";
    }

    // Run via: php public/index.php cron cleanup
    public function cleanup()
    {
        // 1. Delete expired OTPs
        // 2. Cancel pending jobs older than X hours
        
        log_message('info', 'Cron: Cleanup started...');
        
        return "Cleanup Completed";
    }
}
