1use crate::Value;
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4use strum_macros::{AsRefStr, EnumIter, EnumString, IntoStaticStr};
5
6#[derive(
7 PartialEq,
8 Eq,
9 Clone,
10 Debug,
11 Serialize,
12 Deserialize,
13 EnumString,
14 EnumIter,
15 AsRefStr,
16 IntoStaticStr,
17 Default,
18)]
19pub enum PluginLanguage {
20 #[serde(rename = "rust")]
21 #[default]
22 Rust,
23 #[serde(rename = "golang")]
24 Golang,
25 #[serde(rename = "python")]
26 Python,
27 #[serde(rename = "zig")]
28 Zig,
29}
30
31impl PluginLanguage {
32 pub fn string_to_lang(lang: &str) -> Self {
33 if lang == "rust" {
34 Self::Rust
35 } else if lang == "golang" {
36 Self::Golang
37 } else if lang == "zig" {
38 Self::Zig
39 } else if lang == "python" {
40 Self::Python
41 } else {
42 Self::Rust
43 }
44 }
45}
46
47#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize, EnumString, EnumIter, AsRefStr)]
48pub enum PluginCompiler {
49 #[serde(rename = "wasm")]
50 Wasm,
51 #[serde(rename = "wasi")]
52 Wasi,
53 #[serde(rename = "wasix")]
54 Wasix,
55 #[serde(rename = "tinygo")]
56 TinyGo,
57}
58
59#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug, Default)]
64pub struct WakfloWorkspace {
65 pub plugin: WakfloPlugin,
67 }
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct PluginWorkspaceMetadata {
72 pub properties: HashMap<String, serde_json::Value>,
73
74 pub compiler: PluginCompiler,
75 pub name: String,
77
78 pub icon: String,
80
81 pub category: String,
83
84 pub language: PluginLanguage,
86
87 pub version: String,
89
90 pub description: String,
92}
93
94#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug, Default)]
99pub struct WakfloPlugin {
100 pub name: String,
102
103 pub icon: String,
105
106 pub category: String,
108
109 pub language: PluginLanguage,
111
112 pub version: String,
114
115 pub description: String,
117
118 pub documentation: Option<String>,
120
121 pub properties: Option<HashMap<String, Value>>,
122}