"""Smoke test — every model imports cleanly and shares the same metadata."""

from backend.app.models import (
    Artist,
    Base,
    ImageRecord,
)


def test_all_models_use_shared_metadata():
    expected_tables = {
        "artist",
        "source",
        "credential",
        "post",
        "image_record",
        "image_provenance",
        "tag",
        "image_tag",
        "download_event",
    }
    assert expected_tables.issubset(Base.metadata.tables.keys())


def test_artist_has_subscription_flag():
    # Sanity: the unified data model decision (Subscription IS Artist) shows up
    # as a boolean flag on Artist, per spec §3.
    assert "is_subscription" in {c.name for c in Artist.__table__.columns}
    assert "primary_post_id" in {c.name for c in ImageRecord.__table__.columns}
