Skip to main content

plexus_substrate/activations/interactive/
types.rs

1//! Event types for the interactive activation
2
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6/// Events emitted by the wizard method
7#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
8#[serde(tag = "event", rename_all = "snake_case")]
9pub enum WizardEvent {
10    /// Wizard has started
11    Started,
12
13    /// Name has been collected from user
14    NameCollected { name: String },
15
16    /// Template has been selected
17    TemplateSelected { template: String },
18
19    /// Project was created successfully
20    Created { name: String, template: String },
21
22    /// User cancelled the wizard
23    Cancelled,
24
25    /// An error occurred
26    Error { message: String },
27
28    /// Wizard completed
29    Done,
30}
31
32/// Events emitted by the delete method
33#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
34#[serde(tag = "event", rename_all = "snake_case")]
35pub enum DeleteEvent {
36    /// File was deleted
37    Deleted { path: String },
38
39    /// User cancelled the operation
40    Cancelled,
41
42    /// All files processed
43    Done,
44}
45
46/// Events emitted by the confirm method
47#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
48#[serde(tag = "event", rename_all = "snake_case")]
49pub enum ConfirmEvent {
50    /// User confirmed
51    Confirmed,
52
53    /// User declined
54    Declined,
55
56    /// Error occurred (e.g., bidirectional not supported)
57    Error { message: String },
58}