@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

LAYOUT_WITH_LEGEND()

title Kell Creations - Enterprise Data Architecture

Person(owner, "Business Owner")
Person(staff, "Operations Staff")

System_Boundary(platform, "Kell Creations Platform") {
  Container(inventory, "Inventory Application", "Business Application", "Manages materials, finished goods, and stock levels")
  Container(social, "Social Media Management", "Business Application", "Manages campaigns, content, and engagement workflows")
  Container(wpmanage, "WordPress Management", "Business Application", "Manages WordPress publishing, products, and site administration")
  Container(mrp, "Craft Manufacturing / MRP", "Business Application", "Manages BOMs, work orders, and production planning")
  Container(finance, "Financial Analysis", "Business Application", "Provides reporting, forecasting, and analysis")
  Container(datarepo, "Shared Data Repository", "Enterprise Data Service", "Provides common access to shared master and transactional business data")
  Container(txdb, "Transaction Database", "Database", "Stores transactional records, operational data, and history")
  Container(refdata, "Reference Data Store", "Data Store", "Stores controlled reference data, lookup values, categories, and code sets")
  Container(contentstore, "Document and Content Store", "Content Repository", "Stores policies, procedures, attachments, and supporting files")
  Container(audit, "Audit & Logging Service", "Observability Service", "Captures auditable events and data-access records")
  Container(api, "API Orchestrator", "Integration Service", "Coordinates data exchange across internal and external services")
}

System_Ext(wordpress, "WordPress", "www.kellcreations.com")
System_Ext(git, "Forgejo Git", "git.kellsupport.com")
System_Ext(n8n, "n8n", "Automation and workflow engine")

Rel(owner, inventory, "Uses")
Rel(owner, mrp, "Uses")
Rel(owner, finance, "Uses")
Rel(staff, inventory, "Uses")
Rel(staff, social, "Uses")
Rel(staff, wpmanage, "Uses")
Rel(staff, mrp, "Uses")

Rel(inventory, datarepo, "Reads/Writes shared data through")
Rel(social, datarepo, "Reads/Writes shared data through")
Rel(wpmanage, datarepo, "Reads/Writes shared data through")
Rel(mrp, datarepo, "Reads/Writes shared data through")
Rel(finance, datarepo, "Reads/Writes shared data through")

Rel(datarepo, txdb, "Reads/Writes transactional data to")
Rel(datarepo, refdata, "Reads controlled reference data from")
Rel(datarepo, contentstore, "Associates records with documents in")
Rel(datarepo, audit, "Logs data events to")

Rel(api, datarepo, "Uses enterprise data services through")
Rel(api, audit, "Logs integration events to")
Rel(api, wordpress, "Synchronizes products and content with")
Rel(api, n8n, "Triggers workflows and receives updates from")

Rel(contentstore, git, "Stores version-controlled policy and documentation source in")

@enduml