"""Separate service maintenance from jobs that advance the football world."""
from django.core.exceptions import ImproperlyConfigured

INFRASTRUCTURE_JOBS = frozenset({
    "runtime-heartbeat", "outbox-dispatch", "account-email-dispatch", "evidence-scan",
    "notification-delivery", "notification-consumer-retry", "notification-retention", "token-bridge",
    "training-reminders",
})


def select_schedule(schedule, mode):
    if mode == "all":
        return schedule
    if mode not in {"infrastructure", "world"}:
        raise ImproperlyConfigured("FTG_SCHEDULER_MODE must be all, infrastructure or world.")
    return {name: entry for name, entry in schedule.items()
            if (name in INFRASTRUCTURE_JOBS) == (mode == "infrastructure")}
