from typing import Any from scrape_golfpakker import run_golfpakker_scraper from scrape_greenfee import run_greenfee_scraper from scrape_membership import run_scraper as run_membership_scraper from scrape_status import run_daily_scraping from scrape_vtg import run_vtg_scraper from scrape_utils import ProgressCallback async def run_scrape_job(job: dict[str, Any], progress_callback: ProgressCallback | None = None) -> dict[str, Any]: job_type = job["job_type"] facility_ids = job.get("facility_ids") or [] if job_type == "banestatus": result = await run_daily_scraping(facility_ids, progress_callback=progress_callback) elif job_type == "medlemskap": result = await run_membership_scraper(facility_ids, progress_callback=progress_callback) elif job_type == "greenfee": result = await run_greenfee_scraper(facility_ids, progress_callback=progress_callback) elif job_type == "vtg": result = await run_vtg_scraper(facility_ids, progress_callback=progress_callback) elif job_type == "golfpakker": result = await run_golfpakker_scraper(facility_ids, progress_callback=progress_callback) else: raise ValueError(f"Ukjent scrape-jobbtype: {job_type}") return result or {}