// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// Record of why a while-loop block stopped iterating during a run.
/// Reports the `termination_reason` (`max_iterations_reached`,
/// `condition_matched`, or `error`) and the termination conditions that were
/// evaluated on the final iteration (`evaluations`).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WhileLoopTermination {
    /// The operation that produced this artifact
    ///
    /// Defaults to `while_loop_termination`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub operation: Option<String>,
    pub id: String,
    pub run_id: String,
    pub step_id: String,
    /// Why the while-loop terminated
    pub termination_reason: WhileLoopTerminationTerminationReason,
    /// Defaults to `[]`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub evaluations: Option<Vec<ConditionEvaluationResult>>,
    /// Timestamp when this artifact was created.
    pub created_at: String,
}
impl WhileLoopTermination {
    /// Construct a new `WhileLoopTermination` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        id: impl Into<String>,
        run_id: impl Into<String>,
        step_id: impl Into<String>,
        termination_reason: WhileLoopTerminationTerminationReason,
        created_at: impl Into<String>,
    ) -> Self {
        Self {
            operation: Default::default(),
            id: id.into(),
            run_id: run_id.into(),
            step_id: step_id.into(),
            termination_reason,
            evaluations: Default::default(),
            created_at: created_at.into(),
        }
    }
}
