<?php

namespace App\Console\Commands;

use App\Services\Notifications\NotificationCleanupService;
use Illuminate\Console\Command;

class CleanupExpiredNotificationsCommand extends Command
{
    protected $signature = 'notifications:cleanup';
    protected $description = 'Deletes expired notifications from the database.';

    public function handle(NotificationCleanupService $service): int
    {
        $count = $service->cleanupExpired();

        if ($count <= 0) {
            $this->info('No expired notifications found to soft delete.');
            return self::SUCCESS;
        }

        $this->info("Soft-deleted {$count} expired notifications.");

        return self::SUCCESS;
    }
}
