flowchart LR
subgraph S1["🔭 Automated Discovery System"]
A([🔄 Continuous\nDiscovery Running]) -->|"Change event\ndetected"| B[⚠️ Detect\nInfrastructure Change]
end
subgraph S2["📊 IT Management Graph"]
C[🔗 Update Graph with\nDiscovered State] -->|"State stored"| D[(📦 Current\nState Graph)]
end
subgraph S3["🔍 Drift Detection Engine"]
E[📋 Fetch Approved\nBaseline Config] -->|"Baseline loaded"| F[(📄 Baseline\nState Graph)]
D -->|"Actual state"| G
F -->|"Expected state"| G[⚖️ Compare Current\nvs. Baseline]
G -->|""| H{❓ Drift\nDetected?}
H -->|"No drift found"| I([✅ No Action\nRequired])
H -->|"Drift found"| J[🌡️ Calculate\nDrift Severity]
end
subgraph S4["🛡️ Alerting & Remediation"]
K[🔔 Generate\nDrift Alert] --> L{⚙️ Auto-Remediation\nEnabled?}
L -->|"Auto-fix enabled"| M[🤖 Execute\nAuto-Remediation]
L -->|"Manual required"| N[👤 Notify On-Call\nEngineer]
M --> O[📝 Log Drift\nIncident]
N --> O
O --> P[📂 Update Baseline\nif Approved]
P --> Q([🏁 Drift\nRemediated])
end
B -->|"Graph update event"| C
D -->|"Trigger drift check"| E
J -->|"Drift details"| K
I -.->|"Continue monitoring"| A
Q -.->|"Resume monitoring"| A
P -.->|"Baseline updated"| F
style S1 fill:#E3F2FD,stroke:#90CAF9
style S2 fill:#FFF9E6,stroke:#FFE082
style S3 fill:#FFE0B2,stroke:#FFCC80
style S4 fill:#E8F5E9,stroke:#A5D6A7
style H fill:#FFF59D,stroke:#F9A825
style L fill:#FFF59D,stroke:#F9A825
style I fill:#81C784,color:#fff
style Q fill:#66BB6A,color:#fff