"""TS-21 — canonical smoke: the package imports and every public ``__all__`` name
is reachable. Fast (no fixtures, no I/O); tier-0.
"""

from __future__ import annotations

import importlib

import pytest

pytestmark = [pytest.mark.smoke]

_PUBLIC_MODULES = (
    "mgf.fastapi",
    "mgf.fastapi.exceptions",
    "mgf.fastapi.webhooks",
    "mgf.fastapi.security",
    "mgf.fastapi.db",
    "mgf.fastapi.testing",
    "mgf.fastapi.logs",
)


def test_every_public_name_is_reachable() -> None:
    for mod_name in _PUBLIC_MODULES:
        mod = importlib.import_module(mod_name)
        for name in getattr(mod, "__all__", []):
            assert hasattr(mod, name), f"{mod_name}.{name} in __all__ but not importable"


def test_version_is_a_string() -> None:
    import mgf.fastapi

    assert isinstance(mgf.fastapi.__version__, str) and mgf.fastapi.__version__
