"""Tier-0 smoke — build-broken detector.

Minimal post-install sanity: the generic surface imports (without pulling
the Clerk/pyjwt adapter), the mocks construct, and the typed errors map to
401. No fixtures, no I/O. If this fails, the wheel is broken.
"""

from __future__ import annotations

import pytest

pytestmark = pytest.mark.smoke


def test_generic_surface_importable() -> None:
    import mgf.auth as m

    expected = {
        "SessionVerifier",
        "WebhookVerifier",
        "MockSessionVerifier",
        "MockWebhookVerifier",
        "WebhookEvent",
        "InvalidSessionError",
        "InvalidWebhookSignatureError",
    }
    assert expected <= set(m.__all__)


def test_mocks_construct() -> None:
    from mgf.auth import MockSessionVerifier, MockWebhookVerifier

    assert MockSessionVerifier() is not None
    assert MockWebhookVerifier() is not None


def test_auth_errors_are_401() -> None:
    from mgf.auth import InvalidSessionError, InvalidWebhookSignatureError

    assert InvalidSessionError("x").http_status == 401
    assert InvalidWebhookSignatureError("x").http_status == 401
