@startuml
title Email Admin Audit Query Indexing (After)

skinparam backgroundColor #FFFFFF
skinparam defaultFontColor #000000
skinparam ArrowColor #000000
skinparam ParticipantBorderColor #000000
skinparam ParticipantBackgroundColor #D9F2D9
skinparam DatabaseBorderColor #000000
skinparam NoteBackgroundColor #E9F7FF
skinparam NoteBorderColor #000000

actor "Tenant Admin" as Admin
participant "Admin API" as Api
database "admin_audit_logs\n+ target/action/success indexes\n+ metadata GIN index" as Audit
database "email_send_failures\n+ (resolved, created_at)" as Failures
database "emails\n+ (flow, created_at)" as Emails
database "email_templates\n+ (template_key, locale, is_active)" as Templates

Admin -> Api: list/filter email admin data
Api -> Audit: target_id + action + status + metadata filters
Api -> Failures: resolved/freshness triage
Api -> Emails: flow/freshness browse
Api -> Templates: key/locale/active catalog browse

note right of Audit
Index strategy now matches operational admin queries\nfor tenant-scoped audits and drilldowns.
end note

@enduml
