// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// Public live workflow block object.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkflowBlock {
    pub id: String,
    /// Foreign key to workflow
    pub workflow_id: String,
    /// Block type (extract, parse, classifier, etc.)
    #[serde(rename = "type")]
    pub type_: WorkflowBlockType,
    /// Display label for the block
    ///
    /// Defaults to ``.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub label: Option<String>,
    /// X position on canvas
    ///
    /// Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub position_x: Option<f64>,
    /// Y position on canvas
    ///
    /// Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub position_y: Option<f64>,
    /// Block width for resizable blocks
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub width: Option<f64>,
    /// Block height for resizable blocks
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub height: Option<f64>,
    /// Block-specific configuration
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub config: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// ID of parent container (while_loop, for_each)
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parent_id: Option<String>,
    /// Canonical declarative block path used to reconcile imported specs.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub declarative_path: Option<String>,
    /// Authored declarative block id before import-time id regeneration.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub declarative_source_block_id: Option<String>,
    pub updated_at: String,
    /// Schemas resolved for this block from the workflow graph.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub resolved_schemas: Option<std::collections::HashMap<String, serde_json::Value>>,
}
impl WorkflowBlock {
    /// Construct a new `WorkflowBlock` with the required fields set.
    #[allow(deprecated)]
    pub fn new(
        id: impl Into<String>,
        workflow_id: impl Into<String>,
        type_: WorkflowBlockType,
        updated_at: impl Into<String>,
    ) -> Self {
        Self {
            id: id.into(),
            workflow_id: workflow_id.into(),
            type_,
            label: Default::default(),
            position_x: Default::default(),
            position_y: Default::default(),
            width: Default::default(),
            height: Default::default(),
            config: Default::default(),
            parent_id: Default::default(),
            declarative_path: Default::default(),
            declarative_source_block_id: Default::default(),
            updated_at: updated_at.into(),
            resolved_schemas: Default::default(),
        }
    }
}
