hyprstream_workers/workflow/subscription.rs
1//! Workflow subscriptions for event routing
2
3use super::triggers::EventTrigger;
4use super::WorkflowId;
5
6/// Workflow subscription linking a workflow to an event trigger
7#[derive(Debug, Clone)]
8pub struct WorkflowSubscription {
9 /// Workflow ID
10 pub workflow_id: WorkflowId,
11
12 /// Event trigger
13 pub trigger: EventTrigger,
14
15 /// Whether subscription is active
16 pub active: bool,
17}
18
19impl WorkflowSubscription {
20 /// Create a new subscription
21 pub fn new(workflow_id: WorkflowId, trigger: EventTrigger) -> Self {
22 Self {
23 workflow_id,
24 trigger,
25 active: true,
26 }
27 }
28
29 /// Deactivate the subscription
30 pub fn deactivate(&mut self) {
31 self.active = false;
32 }
33}