<?php
namespace App\Console\Commands;

use App\Services\Admin\Mail\AdminMailService;
use Illuminate\Console\Command;

final class DispatchDueAdminMailBatches extends Command
{
    protected $signature = 'admin-mail:dispatch-due {--limit=20}';
    protected $description = 'Dispatch due scheduled admin mail batches';

    public function handle(AdminMailService $svc): int
    {
        $n = $svc->dispatchDueScheduledBatches((int)$this->option('limit'));
        $this->info("dispatched={$n}");
        return 0;
    }
}
