from celery import Celery

from app.config import settings


def create_celery_app() -> Celery:
    app = Celery("wolai-backend")
    app.conf.broker_url = settings.redis_url
    app.conf.result_backend = settings.redis_url
    app.conf.task_routes = {"app.workers.tasks.*": {"queue": "wolai-tasks"}}
    app.autodiscover_tasks(["app.workers"])
    return app


celery_app = create_celery_app()
