@startuml axum_router_composition_before_refactor
title Athena Auth Axum Router Composition (Before Refactor)

skinparam componentStyle rectangle
skinparam shadowing false

package "src/bin/server.rs" {
  component "run()" as run
  component "Inline base_path branching" as inline_branch
  component "auth_router\n- if \"/\": route(\"/*path\")\n- else: route(\"/\") + route(\"/*path\")\nwithout_v07_checks()" as inline_auth
  component "base_router\nroute(\"/\") status\n+ optional /metrics route" as inline_base
  component "Conditional final app wiring\n- merge(auth_router) when \"/\"\n- nest(base_path, auth_router) otherwise\n+ middleware + with_state" as inline_mount
}

component "dispatch_auth_request" as dispatch
component "TenantRuntimeRegistry" as tenants

run --> inline_branch : compute normalized base_path
inline_branch --> inline_auth : build auth router inline
inline_branch --> inline_mount : choose merge vs nest inline
run --> inline_base : build status/metrics routes
inline_auth --> dispatch
inline_mount --> tenants

note right of inline_auth
Legacy wildcard syntax (`/*path`) requires
careful v0.7 compatibility handling and can
panic on Axum 0.8 checks when misconfigured.
end note

@enduml
