use anyhow::Result;
use common_contracts::workflow_types::WorkflowTaskCommand;
use crate::state::AppState;
use crate::workflow_adapter::AlphavantageNode;
use common_contracts::workflow_runner::WorkflowNodeRunner;
use std::sync::Arc;

pub async fn handle_workflow_command(state: AppState, nats: async_nats::Client, cmd: WorkflowTaskCommand) -> Result<()> {
    let node = Arc::new(AlphavantageNode::new(state));
    let runner = WorkflowNodeRunner::new(nats);
    runner.run(node, cmd).await
}

