use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use sqlx::FromRow; use uuid::Uuid; #[derive(Debug, Clone, Copy, PartialEq)] pub enum TriggerKind { Scheduled = 0, TableUpdate = 1, TableInsert = 2, TableDelete = 3, } impl TriggerKind { pub fn from_i32(value: i32) -> Option { match value { 0 => Some(Self::Scheduled), 1 => Some(Self::TableUpdate), 2 => Some(Self::TableInsert), 3 => Some(Self::TableDelete), _ => None, } } } #[derive(Debug, FromRow, Serialize, Deserialize)] pub struct Automation { pub id: Uuid, pub kind: i32, // Using number for trigger type pub target: Option, pub schedule: Option, pub param: String, pub is_active: bool, pub last_triggered: Option>, }