/*
 * 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};

/// RawScript : Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RawScript {
    /// Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments
    #[serde(rename = "input_transforms")]
    pub input_transforms: std::collections::HashMap<String, models::InputTransform>,
    /// The script source code. Should export a 'main' function
    #[serde(rename = "content")]
    pub content: String,
    /// Programming language for this script
    #[serde(rename = "language")]
    pub language: Language,
    /// Optional path for saving this script
    #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
    pub path: Option<String>,
    /// Lock file content for dependencies
    #[serde(rename = "lock", skip_serializing_if = "Option::is_none")]
    pub lock: Option<String>,
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Worker group tag for execution routing
    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
    pub tag: Option<String>,
    /// Maximum concurrent executions of this script
    #[serde(rename = "concurrent_limit", skip_serializing_if = "Option::is_none")]
    pub concurrent_limit: Option<f64>,
    /// Time window for concurrent_limit
    #[serde(rename = "concurrency_time_window_s", skip_serializing_if = "Option::is_none")]
    pub concurrency_time_window_s: Option<f64>,
    /// Custom key for grouping concurrent executions
    #[serde(rename = "custom_concurrency_key", skip_serializing_if = "Option::is_none")]
    pub custom_concurrency_key: Option<String>,
    /// If true, this script is a trigger that can start the flow
    #[serde(rename = "is_trigger", skip_serializing_if = "Option::is_none")]
    pub is_trigger: Option<bool>,
    /// External resources this script accesses (S3 objects, resources, etc.)
    #[serde(rename = "assets", skip_serializing_if = "Option::is_none")]
    pub assets: Option<Vec<models::RawScriptAssetsInner>>,
}

impl RawScript {
    /// Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms
    pub fn new(input_transforms: std::collections::HashMap<String, models::InputTransform>, content: String, language: Language, r#type: Type) -> RawScript {
        RawScript {
            input_transforms,
            content,
            language,
            path: None,
            lock: None,
            r#type,
            tag: None,
            concurrent_limit: None,
            concurrency_time_window_s: None,
            custom_concurrency_key: None,
            is_trigger: None,
            assets: None,
        }
    }
}
/// Programming language for this script
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Language {
    #[serde(rename = "deno")]
    Deno,
    #[serde(rename = "bun")]
    Bun,
    #[serde(rename = "python3")]
    Python3,
    #[serde(rename = "go")]
    Go,
    #[serde(rename = "bash")]
    Bash,
    #[serde(rename = "powershell")]
    Powershell,
    #[serde(rename = "postgresql")]
    Postgresql,
    #[serde(rename = "mysql")]
    Mysql,
    #[serde(rename = "bigquery")]
    Bigquery,
    #[serde(rename = "snowflake")]
    Snowflake,
    #[serde(rename = "mssql")]
    Mssql,
    #[serde(rename = "oracledb")]
    Oracledb,
    #[serde(rename = "graphql")]
    Graphql,
    #[serde(rename = "nativets")]
    Nativets,
    #[serde(rename = "php")]
    Php,
    #[serde(rename = "rust")]
    Rust,
    #[serde(rename = "ansible")]
    Ansible,
    #[serde(rename = "csharp")]
    Csharp,
    #[serde(rename = "nu")]
    Nu,
    #[serde(rename = "java")]
    Java,
    #[serde(rename = "ruby")]
    Ruby,
    #[serde(rename = "rlang")]
    Rlang,
    #[serde(rename = "duckdb")]
    Duckdb,
}

impl Default for Language {
    fn default() -> Language {
        Self::Deno
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "rawscript")]
    Rawscript,
}

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

