@startuml
title Email Admin Audit Query Indexing (Before)

skinparam backgroundColor #FFFFFF
skinparam defaultFontColor #000000
skinparam ArrowColor #000000
skinparam ParticipantBorderColor #000000
skinparam ParticipantBackgroundColor #FFE8CC
skinparam DatabaseBorderColor #000000
skinparam NoteBackgroundColor #FFF4D6
skinparam NoteBorderColor #000000

actor "Tenant Admin" as Admin
participant "Admin API" as Api
database "admin_audit_logs" as Audit
database "emails / email_send_failures / email_templates" as EmailTables

Admin -> Api: list/filter email admin data
Api -> Audit: filter by action/actor/date,\nresource target lookups
Api -> EmailTables: flow/resolved/template filters

note right of Audit
Only basic indexes existed for created_at/action/actor.\nTarget-based and JSON metadata queries were expensive.
end note

note right of EmailTables
No composite indexes for common\nflow/resolved+created query shapes.
end note

@enduml
