@startuml
title Schema Debug Mapping (After Alias Expansion)
skinparam backgroundColor #FFFFFF
skinparam sequence {
  ArrowColor #1D4ED8
  ParticipantBorderColor #1E3A8A
  ParticipantBackgroundColor #DBEAFE
  ParticipantFontColor #0F172A
}

actor "Demo UI" as UI
participant "GET /api/auth/debug/schema" as Endpoint #BFDBFE
database "Schema Probe" as Probe #E2E8F0

UI -> Endpoint: Request debug payload
Endpoint -> Endpoint: Build alias config for all debug tables\n(primary + secondary singular/plural)
Endpoint -> Probe: Probe primary + secondary variants\n(ex: users + user, passkeys + passkey)
Probe --> Endpoint: Variant-aware schema visibility
Endpoint -> Endpoint: Compute explicit boolean blocks\n(primary, secondary, any)
Endpoint --> UI: Enhanced payload:\n- runtime.table_alias_config entries\n- per-row runtime_secondary_lookup_table\n- per-row configured_secondary_mapped_table\n- runtime_status/mapped_status boolean matrix
note right of Endpoint #DCFCE7
After:
- All core tables carry explicit secondary variant config
- Boolean statuses are clear in blocks (primary/secondary/any)
- Debug UI can compare plural/singular readiness directly
end note
@enduml
