from django.core.management.base import BaseCommand
from seasons.automation import process_due_seasons


class Command(BaseCommand):
    help = "Process explicitly configured automatic season calendars."

    def handle(self, *args, **options):
        from core_runtime.services import RuntimeJobService
        result = RuntimeJobService.run(job_name="season-cycle", lock_ttl=540,
            callback=lambda: {"seasons": process_due_seasons()})
        self.stdout.write(str(result))
