// Code generated by oagen. DO NOT EDIT.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
/// Create a new block in a workflow.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkflowBlockCreateRequest {
    /// Workflow to create the block in.
    pub workflow_id: String,
    /// Block ID. Omit to let the server generate one (recommended). Block IDs must be unique across your organization, not just within a workflow — reusing a custom id like 'block_extract' in more than one workflow fails with 409.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub id: Option<String>,
    /// Block type
    #[serde(rename = "type")]
    pub type_: WorkflowBlockCreateRequestType,
    /// Display label
    ///
    /// Defaults to ``.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub label: Option<String>,
    /// X position
    ///
    /// Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub position_x: Option<f64>,
    /// Y position
    ///
    /// Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub position_y: Option<f64>,
    /// Block width
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub width: Option<f64>,
    /// Block height
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub height: Option<f64>,
    /// Block configuration
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub config: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// ID of parent container block (while_loop, for_each)
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parent_id: Option<String>,
}
impl WorkflowBlockCreateRequest {
    /// Construct a new `WorkflowBlockCreateRequest` with the required fields set.
    #[allow(deprecated)]
    pub fn new(workflow_id: impl Into<String>, type_: WorkflowBlockCreateRequestType) -> Self {
        Self {
            workflow_id: workflow_id.into(),
            id: Default::default(),
            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(),
        }
    }
}
