"""Dependency / layering tests."""
from pathlib import Path

from app.repositories.base import TenantBaseRepository
from app.repositories.foundation import SportsCenterRepository
from app.services import foundation as services


def test_repositories_inherit_tenant_base():
    assert issubclass(SportsCenterRepository, TenantBaseRepository)


def test_services_have_no_fastapi_import():
    path = Path(services.__file__)
    text = path.read_text(encoding="utf-8")
    assert "fastapi" not in text.lower()


def test_providers_are_protocols_only():
    from app import providers
    from typing import get_type_hints
    import inspect

    path = Path(providers.__file__).parent / "contracts.py"
    text = path.read_text(encoding="utf-8")
    assert "Protocol" in text
    assert "httpx" not in text
    assert "sqlalchemy" not in text
