"""Optional Celery worker for sync reconcile + report refresh."""

from __future__ import annotations

import os

from celery import Celery

broker = os.environ.get("CELERY_BROKER_URL", "redis://localhost:6379/0")

celery_app = Celery("wesp_orchestrator", broker=broker)
celery_app.conf.task_serializer = "json"
celery_app.conf.result_serializer = "json"
celery_app.conf.accept_content = ["json"]


@celery_app.task(name="sync.reconcile")
def reconcile_task() -> int:
    from app.worker import run_sync_reconcile

    return run_sync_reconcile()
