"""Performance / index justification for Phase 10.1 driver tables."""
from __future__ import annotations

from app.core.database import Base
import app.models  # noqa: F401


def test_driver_indexes_exist():
    drivers = Base.metadata.tables["drivers"]
    index_names = {idx.name for idx in drivers.indexes}
    assert "ix_drivers_tenant_status" in index_names
    assert "ix_drivers_org" in index_names
    assert "ix_drivers_hub" in index_names
    assert "ix_drivers_mobile" in index_names
    assert "ix_drivers_display_name" in index_names


def test_outbox_indexes_exist():
    outbox = Base.metadata.tables["outbox_events"]
    index_names = {idx.name for idx in outbox.indexes}
    assert "ix_delivery_outbox_status" in index_names
    assert "ix_delivery_outbox_tenant" in index_names
