use serde::Serialize;
pub struct DreamEngine {
insights: Vec<DreamInsight>,
}
#[derive(Debug, Clone, Serialize)]
pub struct DreamInsight {
pub workflow_id: String,
pub insight_type: InsightType,
pub message: String,
pub severity: String,
}
#[derive(Debug, Clone, Serialize)]
pub enum InsightType {
DependencyHealth,
ConfigurationDrift,
ScheduleOptimization,
UnusedWorkflow,
SecurityConcern,
}
impl DreamEngine {
pub fn new() -> Self {
Self {
insights: Vec::new(),
}
}
pub fn add_insight(
&mut self,
workflow_id: &str,
insight_type: InsightType,
message: &str,
severity: &str,
) {
self.insights.push(DreamInsight {
workflow_id: workflow_id.to_string(),
insight_type,
message: message.to_string(),
severity: severity.to_string(),
});
}
pub fn get_insights(&self) -> &[DreamInsight] {
&self.insights
}
pub fn insights_for_workflow(&self, workflow_id: &str) -> Vec<&DreamInsight> {
self.insights
.iter()
.filter(|i| i.workflow_id == workflow_id)
.collect()
}
pub fn clear(&mut self) {
self.insights.clear();
}
}
impl Default for DreamEngine {
fn default() -> Self {
Self::new()
}
}