data_modelling_sdk/workspace/
mod.rs1use serde::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
27pub struct WorkspaceInfo {
28 pub model_id: String,
30 pub name: String,
32 pub git_directory_path: Option<String>,
34 pub email: Option<String>,
36 pub domain: Option<String>,
38}
39
40impl Default for WorkspaceInfo {
41 fn default() -> Self {
42 Self {
43 model_id: "default".to_string(),
44 name: "Default Workspace".to_string(),
45 git_directory_path: None,
46 email: None,
47 domain: None,
48 }
49 }
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
67pub struct ProfileInfo {
68 pub email: String,
70 pub domains: Vec<String>,
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76pub struct CreateWorkspaceRequest {
77 pub email: String,
78 pub domain: String,
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83pub struct CreateWorkspaceResponse {
84 pub success: bool,
85 pub workspace: Option<WorkspaceInfo>,
86 pub error: Option<String>,
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize)]
91pub struct ListProfilesResponse {
92 pub profiles: Vec<ProfileInfo>,
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97pub struct LoadProfileRequest {
98 pub domain: String,
99 pub email: String,
100}
101
102#[cfg(test)]
103mod tests {
104 use super::*;
105
106 #[test]
107 fn test_workspace_info_default() {
108 let info = WorkspaceInfo::default();
109 assert_eq!(info.model_id, "default");
110 assert_eq!(info.name, "Default Workspace");
111 }
112
113 #[test]
114 fn test_profile_info_serialization() {
115 let profile = ProfileInfo {
116 email: "test@example.com".to_string(),
117 domains: vec!["Risk".to_string(), "Finance".to_string()],
118 };
119
120 let json = serde_json::to_string(&profile).unwrap();
121 let parsed: ProfileInfo = serde_json::from_str(&json).unwrap();
122 assert_eq!(profile, parsed);
123 }
124}