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

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

/// FlowModule : A single step in a flow. Can be a script, subflow, loop, or branch
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FlowModule {
    /// Unique identifier for this step. Used to reference results via 'results.step_id'. Must be a valid identifier (alphanumeric, underscore, hyphen)
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "value")]
    pub value: Box<models::FlowModuleValue>,
    #[serde(rename = "stop_after_if", skip_serializing_if = "Option::is_none")]
    pub stop_after_if: Option<Box<models::StopAfterIf>>,
    #[serde(rename = "stop_after_all_iters_if", skip_serializing_if = "Option::is_none")]
    pub stop_after_all_iters_if: Option<Box<models::StopAfterIf>>,
    #[serde(rename = "skip_if", skip_serializing_if = "Option::is_none")]
    pub skip_if: Option<Box<models::FlowModuleSkipIf>>,
    #[serde(rename = "sleep", skip_serializing_if = "Option::is_none")]
    pub sleep: Option<Box<models::InputTransform>>,
    /// Cache duration in seconds for this step's results
    #[serde(rename = "cache_ttl", skip_serializing_if = "Option::is_none")]
    pub cache_ttl: Option<f64>,
    #[serde(rename = "cache_ignore_s3_path", skip_serializing_if = "Option::is_none")]
    pub cache_ignore_s3_path: Option<bool>,
    #[serde(rename = "timeout", skip_serializing_if = "Option::is_none")]
    pub timeout: Option<Box<models::InputTransform>>,
    /// If set, delete the step's args, result and logs after this many seconds following job completion
    #[serde(rename = "delete_after_secs", skip_serializing_if = "Option::is_none")]
    pub delete_after_secs: Option<i32>,
    /// Short description of what this step does
    #[serde(rename = "summary", skip_serializing_if = "Option::is_none")]
    pub summary: Option<String>,
    #[serde(rename = "mock", skip_serializing_if = "Option::is_none")]
    pub mock: Option<Box<models::FlowModuleMock>>,
    #[serde(rename = "suspend", skip_serializing_if = "Option::is_none")]
    pub suspend: Option<Box<models::FlowModuleSuspend>>,
    /// Execution priority for this step (higher numbers run first)
    #[serde(rename = "priority", skip_serializing_if = "Option::is_none")]
    pub priority: Option<f64>,
    /// If true, flow continues even if this step fails
    #[serde(rename = "continue_on_error", skip_serializing_if = "Option::is_none")]
    pub continue_on_error: Option<bool>,
    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
    pub retry: Option<Box<models::Retry>>,
    #[serde(rename = "debouncing", skip_serializing_if = "Option::is_none")]
    pub debouncing: Option<Box<models::FlowModuleDebouncing>>,
}

impl FlowModule {
    /// A single step in a flow. Can be a script, subflow, loop, or branch
    pub fn new(id: String, value: models::FlowModuleValue) -> FlowModule {
        FlowModule {
            id,
            value: Box::new(value),
            stop_after_if: None,
            stop_after_all_iters_if: None,
            skip_if: None,
            sleep: None,
            cache_ttl: None,
            cache_ignore_s3_path: None,
            timeout: None,
            delete_after_secs: None,
            summary: None,
            mock: None,
            suspend: None,
            priority: None,
            continue_on_error: None,
            retry: None,
            debouncing: None,
        }
    }
}

