// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// Public block version resource without tenant or storage-only fields.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkflowBlockVersion {
    /// Public content-addressed block version ID
    pub id: String,
    /// Stable logical block ID
    pub block_id: String,
    /// Source workflow ID
    pub workflow_id: String,
    /// Workflow version this block version belongs to
    pub workflow_version_id: String,
    #[serde(rename = "type")]
    pub type_: WorkflowBlockVersionType,
    /// Defaults to ``.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub label: Option<String>,
    /// Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub position_x: Option<f64>,
    /// Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub position_y: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub width: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub height: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parent_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub config: Option<std::collections::HashMap<String, serde_json::Value>>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub resolved_schemas: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// Stable SHA-256 hash of the executable block config
    ///
    /// Defaults to ``.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub config_hash: Option<String>,
    pub created_at: String,
}
impl WorkflowBlockVersion {
    /// Construct a new `WorkflowBlockVersion` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        id: impl Into<String>,
        block_id: impl Into<String>,
        workflow_id: impl Into<String>,
        workflow_version_id: impl Into<String>,
        type_: WorkflowBlockVersionType,
        created_at: impl Into<String>,
    ) -> Self {
        Self {
            id: id.into(),
            block_id: block_id.into(),
            workflow_id: workflow_id.into(),
            workflow_version_id: workflow_version_id.into(),
            type_,
            label: Default::default(),
            position_x: Default::default(),
            position_y: Default::default(),
            width: Default::default(),
            height: Default::default(),
            parent_id: Default::default(),
            config: Default::default(),
            resolved_schemas: Default::default(),
            config_hash: Default::default(),
            created_at: created_at.into(),
        }
    }
}
