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

title Athena Auth Email Templates (Before)

rectangle "Tenant Runtime A" as TenantA #EAF2FF {
  component "EmailVerificationPlugin" as A1 #D8E8FF
  component "PasswordManagementPlugin" as A2 #D8E8FF
  component "UserManagementPlugin" as A3 #D8E8FF
  component "TwoFactorPlugin" as A4 #D8E8FF
  component "OrganizationPlugin" as A5 #D8E8FF
}

rectangle "Tenant Runtime B" as TenantB #FFEEDB {
  component "Same hardcoded template builders" as B1 #FFE3C4
}

component "Hardcoded template functions\n(verification/reset/otp/etc.)" as StaticTemplates #F4F4F4
component "EmailProvider (SMTP/API)" as Provider #E7F7E7

database "email_templates table\n(per schema)" as EmailTemplateTable #F8F8F8

A1 --> StaticTemplates
A2 --> StaticTemplates
A3 --> StaticTemplates
A4 --> StaticTemplates
A5 --> StaticTemplates
B1 --> StaticTemplates

StaticTemplates --> Provider

note right of EmailTemplateTable
Table exists, but runtime
email flows do not read it.
Tenants get identical copy
unless custom plugin callbacks
are written per flow.
end note
@enduml
