/*
 * Streams API
 *
 * Manage Tapis Streams API.
 *
 * The version of the OpenAPI document: 1
 * Contact: cicsupport@tacc.utexas.edu
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NewChannel {
    /// User defined channel id.
    #[serde(rename = "channel_id")]
    pub channel_id: String,
    /// User defined channel name.
    #[serde(rename = "channel_name")]
    pub channel_name: String,
    /// Template id. (public templates include default_threshold or default_deadman)
    #[serde(rename = "template_id")]
    pub template_id: String,
    /// Type of Checks (threshold or deadman)
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<Type>,
    #[serde(
        rename = "triggers_with_actions",
        skip_serializing_if = "Option::is_none"
    )]
    pub triggers_with_actions: Option<Vec<models::NewChannelTriggersWithActionsInner>>,
}

impl NewChannel {
    pub fn new(channel_id: String, channel_name: String, template_id: String) -> NewChannel {
        NewChannel {
            channel_id,
            channel_name,
            template_id,
            r#type: None,
            triggers_with_actions: None,
        }
    }
}
/// Type of Checks (threshold or deadman)
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum Type {
    #[serde(rename = "threshold")]
    #[default]
    Threshold,
    #[serde(rename = "deadman")]
    Deadman,
}
