use heromodels::db::hero::OurDB; use heromodels::db::{Collection, Db}; use heromodels::models::flow::{Flow, FlowStep, SignatureRequirement}; use heromodels_core::Model; use std::sync::Arc; /// Seed the mock database with flow data #[cfg(feature = "flow")] pub fn seed_flow_data(db: Arc) { // Create a flow let flow = Flow::new(None, "Onboarding Flow".to_string()) .description("New employee onboarding process".to_string()) .status("active".to_string()); // Create a signature requirement first let sig_req = SignatureRequirement::new( None, 1, "hr_manager_pubkey".to_string(), "Please sign the employment contract".to_string(), ); let (sig_req_id, saved_sig_req) = db .collection::() .expect("Failed to get SignatureRequirement collection") .set(&sig_req) .expect("Failed to store signature requirement"); // Create a flow step and add the signature requirement let step = FlowStep::new(None, 1) .description("Complete HR paperwork".to_string()) .add_signature_requirement(sig_req_id); let (step_id, saved_step) = db .collection::() .expect("Failed to get FlowStep collection") .set(&step) .expect("Failed to store flow step"); // Add the step to the flow let flow_with_step = flow.add_step(step_id); // Store the flow let (_flow_id, saved_flow) = db .collection::() .expect("Failed to get Flow collection") .set(&flow_with_step) .expect("Failed to store flow"); println!("Mock database seeded with flow data:"); println!( " - Added flow: {} (ID: {})", saved_flow.name, saved_flow.get_id() ); println!( " - Added step with order: {} (ID: {})", saved_step.step_order, saved_step.get_id() ); println!( " - Added signature requirement for: {} (ID: {})", saved_sig_req.public_key, saved_sig_req.get_id() ); }