//! Task outbox for side effects
//!
//! The outbox pattern allows the executor to record side effects (like task creation)
//! without actually performing them. The external orchestrator is responsible for
//! processing the outbox after execution.

use super::types::Val;
use std::collections::HashMap;

/// A task creation side effect
///
/// Represents a request to create a new task. This is added to the outbox
/// when Task.run() is called, and the external orchestrator will batch-create
/// these tasks.
#[derive(Debug, Clone, PartialEq)]
pub struct TaskCreation {
    /// The unique ID for this task (UUID generated by Task.run)
    pub task_id: String,

    /// The name of the workflow/task to run
    pub task_name: String,

    /// The inputs to pass to the task
    pub inputs: HashMap<String, Val>,
}

impl TaskCreation {
    /// Create a new task creation side effect
    pub fn new(task_id: String, task_name: String, inputs: HashMap<String, Val>) -> Self {
        Self {
            task_id,
            task_name,
            inputs,
        }
    }
}

/// Task outbox - collection of side effects
pub type Outbox = Vec<TaskCreation>;
