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

title Admin Email Template Management (After)

actor "Admin Operator" as Admin

rectangle "AdminPlugin" as AdminPlugin #EAF2FF {
  component "POST /admin/email-template/create" as CreateTpl #D8E8FF
  component "GET /admin/email-template/list" as ListTpl #D8E8FF
  component "POST /admin/email-template/update" as UpdateTpl #D8E8FF
  component "POST /admin/email-template/delete" as DeleteTpl #D8E8FF
  component "write_audit(...)" as Audit #E7F7E7
}

rectangle "Tenant-scoped DB Adapter" as Adapter #F6F6F6 {
  component "create/list/update/delete_email_template" as AdapterCrud #F4F4F4
  database "tenant_n.email_templates" as TplTable #FFFFFF
}

Admin --> CreateTpl
Admin --> ListTpl
Admin --> UpdateTpl
Admin --> DeleteTpl

CreateTpl --> AdapterCrud
ListTpl --> AdapterCrud
UpdateTpl --> AdapterCrud
DeleteTpl --> AdapterCrud
AdapterCrud --> TplTable

CreateTpl --> Audit
ListTpl --> Audit
UpdateTpl --> Audit
DeleteTpl --> Audit

note right of Adapter
Multitenancy routing already selects
per-tenant runtime + schema.
CRUD operations apply to that
resolved tenant table only.
end note
@enduml
