/*
 * Orvanta API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.2.0
 * Contact: contact@orvanta.cloud
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// ForloopFlow : Executes nested modules in a loop over an iterator. Inside the loop, use 'flow_input.iter.value' to access the current iteration value, and 'flow_input.iter.index' for the index. Supports parallel execution for better performance on I/O-bound operations
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ForloopFlow {
    /// Steps to execute for each iteration. These can reference the iteration value via 'flow_input.iter.value'
    #[serde(rename = "modules")]
    pub modules: Vec<models::FlowModule>,
    #[serde(rename = "iterator")]
    pub iterator: Box<models::InputTransform>,
    /// If true, iteration failures don't stop the loop. Failed iterations return null
    #[serde(rename = "skip_failures")]
    pub skip_failures: bool,
    #[serde(rename = "type")]
    pub r#type: Type,
    /// If true, iterations run concurrently (faster for I/O-bound operations). Use with parallelism to control concurrency
    #[serde(rename = "parallel", skip_serializing_if = "Option::is_none")]
    pub parallel: Option<bool>,
    #[serde(rename = "parallelism", skip_serializing_if = "Option::is_none")]
    pub parallelism: Option<Box<models::InputTransform>>,
    #[serde(rename = "squash", skip_serializing_if = "Option::is_none")]
    pub squash: Option<bool>,
}

impl ForloopFlow {
    /// Executes nested modules in a loop over an iterator. Inside the loop, use 'flow_input.iter.value' to access the current iteration value, and 'flow_input.iter.index' for the index. Supports parallel execution for better performance on I/O-bound operations
    pub fn new(modules: Vec<models::FlowModule>, iterator: models::InputTransform, skip_failures: bool, r#type: Type) -> ForloopFlow {
        ForloopFlow {
            modules,
            iterator: Box::new(iterator),
            skip_failures,
            r#type,
            parallel: None,
            parallelism: None,
            squash: None,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "forloopflow")]
    Forloopflow,
}

impl Default for Type {
    fn default() -> Type {
        Self::Forloopflow
    }
}

