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

/// JavascriptTransform : JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct JavascriptTransform {
    /// JavaScript expression returning the value. Available variables - results (object with all previous step results), flow_input (flow inputs), flow_input.iter (in loops)
    #[serde(rename = "expr")]
    pub expr: String,
    #[serde(rename = "type")]
    pub r#type: Type,
}

impl JavascriptTransform {
    /// JavaScript expression evaluated at runtime. Can reference previous step results via 'results.step_id' or flow inputs via 'flow_input.property'. Inside loops, use 'flow_input.iter.value' for the current iteration value
    pub fn new(expr: String, r#type: Type) -> JavascriptTransform {
        JavascriptTransform {
            expr,
            r#type,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "javascript")]
    Javascript,
}

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

