// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// Result of evaluating ONE assertion against a block's output.
/// `outcome` is a verdict only — pass / fail / blocked. An execution
/// error (the assertion couldn't be evaluated because of a type error,
/// invalid regex, schema validation crash, block execution crash, etc.) is
/// expressed by `outcome="blocked"` with a populated `failure` whose
/// `code` identifies the specific failure mode (`execution_error`,
/// `type_error`, `invalid_regex`, `schema_invalid`,
/// `block_execution_failed`, ...).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AssertionResult {
    pub assertion_id: String,
    pub condition_kind: String,
    pub outcome: AssertionOutcome,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub actual_value: Option<serde_json::Value>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub expected_value: Option<serde_json::Value>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub score: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub threshold: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub metric_kind: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub assertion_label: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub failure: Option<AssertionFailure>,
}
impl AssertionResult {
    /// Construct a new `AssertionResult` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        assertion_id: impl Into<String>,
        condition_kind: impl Into<String>,
        outcome: AssertionOutcome,
    ) -> Self {
        Self {
            assertion_id: assertion_id.into(),
            condition_kind: condition_kind.into(),
            outcome,
            actual_value: Default::default(),
            expected_value: Default::default(),
            score: Default::default(),
            threshold: Default::default(),
            metric_kind: Default::default(),
            assertion_label: Default::default(),
            failure: Default::default(),
        }
    }
}
