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

/// NativeTriggerData : Data for creating or updating a native trigger
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NativeTriggerData {
    /// The path to the script or flow that will be triggered
    #[serde(rename = "script_path")]
    pub script_path: String,
    /// Whether the trigger targets a flow (true) or a script (false)
    #[serde(rename = "is_flow")]
    pub is_flow: bool,
    /// Service-specific configuration (e.g., event types, filters)
    #[serde(rename = "service_config")]
    pub service_config: std::collections::HashMap<String, serde_json::Value>,
    /// Short summary to be displayed when listed
    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub summary: Option<Option<String>>,
}

impl NativeTriggerData {
    /// Data for creating or updating a native trigger
    pub fn new(script_path: String, is_flow: bool, service_config: std::collections::HashMap<String, serde_json::Value>) -> NativeTriggerData {
        NativeTriggerData {
            script_path,
            is_flow,
            service_config,
            summary: None,
        }
    }
}

