// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// Public block execution result for a single workflow block.
/// Terminal state is carried by the discriminated ``lifecycle`` union. The
/// legacy flat ``success`` / ``error`` / ``skipped`` fields were removed in
/// the hard cutover — they let invalid combinations (``success=true`` with
/// a non-empty ``error``) be representable on the wire and forced consumers
/// to know an undocumented field-precedence rule.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StoredBlockExecution {
    /// Unique block execution ID
    pub id: String,
    /// Workflow the block belongs to
    pub workflow_id: String,
    /// Run whose inputs were used
    pub run_id: String,
    /// ID of the block that was executed
    pub block_id: String,
    /// Type of the block
    pub block_type: String,
    /// Terminal lifecycle state for this block execution. One of ``{status: 'completed'}``, ``{status: 'error', message: ...}``, or ``{status: 'skipped', reason: ...}``.
    pub lifecycle: StoredBlockExecutionLifecycleOneOf,
    /// Input payloads keyed by handle ID (file metadata for files, data for json)
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub handle_inputs: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// Canonical persisted-ref artifact for this block execution (operation + id), if any
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub artifact: Option<StepArtifactRef>,
    /// Output payloads keyed by handle ID
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub handle_outputs: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// Active output handles for routing decisions
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub routing_decision: Option<Vec<String>>,
    /// Duration of the block execution in milliseconds
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub duration_ms: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_at: Option<String>,
    /// The draft block config used for this block execution
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub block_config: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// The step ID that was used for inputs (includes iteration prefix if applicable)
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub step_id: Option<String>,
    /// When the block has multiple iterations, lists all available ones
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub available_iterations: Option<Vec<std::collections::HashMap<String, serde_json::Value>>>,
}
