@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontColor #000000
skinparam ArrowColor #000000
skinparam componentBorderColor #000000
skinparam packageBorderColor #000000
skinparam databaseBorderColor #000000
skinparam noteBorderColor #000000
skinparam noteBackgroundColor #FFFCE8
skinparam shadowing false
left to right direction

title Multi-tenant Email Admin Surface (Before)

actor "Tenant Admin" as Admin

rectangle "Tenant Runtime (resolved by x-athena-tenant)" as Runtime #EAF2FF {
  component "AdminPlugin" as AdminPlugin #D8E8FF
  component "GET /admin/email/list" as ListEmails #D8E8FF
  component "Email template CRUD\n(create/list/update/delete)" as TemplateCrud #D8E8FF
  component "write_audit(...)" as Audit #E7F7E7
}

database "emails" as EmailsTable #FFFFFF
database "email_send_failures" as FailuresTable #FFFFFF
database "email_templates" as TemplatesTable #FFFFFF
database "admin_audit_logs" as AdminAudit #FFFFFF

Admin --> ListEmails
Admin --> TemplateCrud

ListEmails --> EmailsTable : list only\n(limit/offset)
TemplateCrud --> TemplatesTable : full CRUD

ListEmails --> Audit
TemplateCrud --> Audit
Audit --> AdminAudit

note bottom of FailuresTable
Failures are written by runtime email flows,
but no admin CRUD/list/get/update/delete API exists.
end note
@enduml
