// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// Record of a function block's execution during a workflow run.
/// Captures the `inputs` passed to the function, the `output` it returned,
/// how long it ran (`duration_ms`), and any `error` if execution failed.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FunctionInvocation {
    /// The operation that produced this artifact
    ///
    /// Defaults to `function_invocation`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub operation: Option<String>,
    pub id: String,
    pub run_id: String,
    pub step_id: String,
    /// Defaults to `{}`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub inputs: Option<std::collections::HashMap<String, serde_json::Value>>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub output: Option<serde_json::Value>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub duration_ms: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub error: Option<ErrorDetails>,
    /// Timestamp when this artifact was created.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub created_at: Option<String>,
}
impl FunctionInvocation {
    /// Construct a new `FunctionInvocation` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        id: impl Into<String>,
        run_id: impl Into<String>,
        step_id: impl Into<String>,
    ) -> Self {
        Self {
            operation: Default::default(),
            id: id.into(),
            run_id: run_id.into(),
            step_id: step_id.into(),
            inputs: Default::default(),
            output: Default::default(),
            duration_ms: Default::default(),
            error: Default::default(),
            created_at: Default::default(),
        }
    }
}
