import pytest
from rest_framework.test import APIClient


@pytest.fixture
def api_client():
    """API client for testing"""
    return APIClient()


@pytest.fixture(autouse=True)
def celery_eager(settings):
    """Configure Celery to run tasks eagerly for testing."""
    settings.CELERY_TASK_ALWAYS_EAGER = True
    settings.CELERY_TASK_EAGER_PROPAGATES = True


@pytest.fixture
def factory():
    """Factory fixture to create model instances easily."""

    def _factory(model, **kwargs):
        return model.objects.create(**kwargs)

    return _factory


# TODO: Add project-specific fixtures here, e.g.:
# @pytest.fixture
# def _authenticated_user(api_client):
#     """Authenticated user for testing"""
#     user = UserFactory()
#     api_client.force_authenticate(user=user)
#     return user
