// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// The outcome of applying a workflow YAML definition: whether the workflow was `created`, the changes made, and a `rendered_plan`.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DeclarativeApplyResponse {
    pub workflow_id: String,
    pub action: DeclarativeApplyResponseAction,
    pub created: bool,
    pub block_count: i64,
    pub edge_count: i64,
    pub diagnostics: std::collections::HashMap<String, serde_json::Value>,
    /// Defaults to `workflows-plan/v1`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub format_version: Option<String>,
    /// Defaults to `{"add":0,"change":0,"destroy":0,"replace":0,"noop":0,"total":0,"has_changes":false}`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub summary: Option<DeclarativePlanSummary>,
    /// Defaults to `[]`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub resource_changes: Option<Vec<DeclarativePlanResourceChange>>,
    /// Defaults to `No changes. Workflow spec is up to date.`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub rendered_plan: Option<String>,
}
impl DeclarativeApplyResponse {
    /// Construct a new `DeclarativeApplyResponse` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        workflow_id: impl Into<String>,
        action: DeclarativeApplyResponseAction,
        created: bool,
        block_count: i64,
        edge_count: i64,
        diagnostics: std::collections::HashMap<String, serde_json::Value>,
    ) -> Self {
        Self {
            workflow_id: workflow_id.into(),
            action,
            created,
            block_count,
            edge_count,
            diagnostics,
            format_version: Default::default(),
            summary: Default::default(),
            resource_changes: Default::default(),
            rendered_plan: Default::default(),
        }
    }
}
