from django.core.management.base import BaseCommand

from monitoring.scheduling import ensure_monitoring_schedule


class Command(BaseCommand):
    help = "Cria ou atualiza a agenda Celery Beat da monitorização de websites."

    def handle(self, *args, **options):
        tasks = ensure_monitoring_schedule()
        self.stdout.write(self.style.SUCCESS(f"{len(tasks)} tarefas de monitorização criadas/atualizadas."))
