<?php

namespace App\Console\Commands;

use App\Models\Reminder;
use Illuminate\Console\Command;

class SendReminders extends Command
{
    protected $signature = 'reminders:send';
    protected $description = 'Send document expiry reminders';
    
    public function handle()
    {
        $today = now()->toDateString();
        $reminders = Reminder::where('reminder_date', $today)
            ->where('is_sent', false)
            ->with('document.company')
            ->get();
        
        $count = 0;
        foreach ($reminders as $reminder) {
            // এখানে আপনার নোটিফিকেশন লজিক
            $this->info("Reminder for: " . $reminder->document->file_name);
            
            $reminder->update([
                'is_sent' => true,
                'sent_at' => now()
            ]);
            $count++;
        }
        
        $this->info("Sent {$count} reminders");
    }
}