// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// A batch execution of a workflow's tests, with overall `lifecycle`, `timing`, and pass/fail `counts`.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkflowTestRun {
    pub id: String,
    pub workflow_id: String,
    pub workflow_version_id: String,
    pub trigger: TriggerInfo,
    pub lifecycle: WorkflowTestResultLifecycleOneOf,
    pub timing: WorkflowTestRunTiming,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub target: Option<WorkflowTestBlockTarget>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub test_id: Option<String>,
    pub total_tests: i64,
    /// Defaults to `{"lifecycle_counts":{"cancelled":0,"completed":0,"error":0,"pending":0,"queued":0,"running":0},"outcome":{"blocked":0,"failed":0,"passed":0}}`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub counts: Option<BlockTestBatchExecutionCounts>,
}
impl WorkflowTestRun {
    /// Construct a new `WorkflowTestRun` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        id: impl Into<String>,
        workflow_id: impl Into<String>,
        workflow_version_id: impl Into<String>,
        trigger: TriggerInfo,
        lifecycle: WorkflowTestResultLifecycleOneOf,
        timing: WorkflowTestRunTiming,
        total_tests: i64,
    ) -> Self {
        Self {
            id: id.into(),
            workflow_id: workflow_id.into(),
            workflow_version_id: workflow_version_id.into(),
            trigger,
            lifecycle,
            timing,
            target: Default::default(),
            test_id: Default::default(),
            total_tests,
            counts: Default::default(),
        }
    }
}
