1use chrono::{DateTime, Utc};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5pub use systemprompt_models::profile::ProfileInfo;
6
7#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
8pub struct CredentialsInfo {
9 pub authenticated: bool,
10 #[serde(skip_serializing_if = "Option::is_none")]
11 pub user_email: Option<String>,
12 pub token_expired: bool,
13}
14
15#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
16pub struct TenantStatusInfo {
17 pub id: String,
18 pub name: String,
19 pub status: String,
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub url: Option<String>,
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub message: Option<String>,
24 pub configured_in_profile: bool,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
28pub struct CloudStatusOutput {
29 #[serde(skip_serializing_if = "Option::is_none")]
30 pub profile: Option<ProfileInfo>,
31 pub credentials: CredentialsInfo,
32 pub tenants: Vec<TenantStatusInfo>,
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
36pub struct TenantPlanInfo {
37 pub name: String,
38 pub memory_mb: i32,
39 pub volume_gb: i32,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
43pub struct LoginTenantInfo {
44 pub id: String,
45 pub name: String,
46 #[serde(skip_serializing_if = "Option::is_none")]
47 pub subscription_status: Option<String>,
48 #[serde(skip_serializing_if = "Option::is_none")]
49 pub plan: Option<TenantPlanInfo>,
50 #[serde(skip_serializing_if = "Option::is_none")]
51 pub region: Option<String>,
52 #[serde(skip_serializing_if = "Option::is_none")]
53 pub hostname: Option<String>,
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
57pub struct LoginUserInfo {
58 pub id: String,
59 pub email: String,
60 #[serde(skip_serializing_if = "Option::is_none")]
61 pub name: Option<String>,
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
65pub struct LoginCustomerInfo {
66 pub id: String,
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
70pub struct LoginOutput {
71 pub user: LoginUserInfo,
72 #[serde(skip_serializing_if = "Option::is_none")]
73 pub customer: Option<LoginCustomerInfo>,
74 pub tenants: Vec<LoginTenantInfo>,
75 pub credentials_path: String,
76 pub tenants_path: String,
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
80pub struct WhoamiOutput {
81 pub user_email: String,
82 pub api_url: String,
83 pub token_status: String,
84 pub authenticated_at: DateTime<Utc>,
85 pub local_profiles: usize,
86 pub cloud_tenants: usize,
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
90pub struct LogoutOutput {
91 pub message: String,
92 #[serde(skip_serializing_if = "Option::is_none")]
93 pub credentials_path: Option<String>,
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
97pub struct TenantSummary {
98 pub id: String,
99 pub name: String,
100 pub tenant_type: String,
101 pub has_database: bool,
102}
103
104#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
105pub struct TenantListOutput {
106 pub tenants: Vec<TenantSummary>,
107 pub total: usize,
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
111pub struct TenantDetailOutput {
112 pub id: String,
113 pub name: String,
114 pub tenant_type: String,
115 #[serde(skip_serializing_if = "Option::is_none")]
116 pub app_id: Option<String>,
117 #[serde(skip_serializing_if = "Option::is_none")]
118 pub hostname: Option<String>,
119 #[serde(skip_serializing_if = "Option::is_none")]
120 pub region: Option<String>,
121 pub has_database: bool,
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
125pub struct TenantCreateOutput {
126 pub id: String,
127 pub name: String,
128 pub tenant_type: String,
129 #[serde(skip_serializing_if = "Option::is_none")]
130 pub database_url: Option<String>,
131 #[serde(skip_serializing_if = "Option::is_none")]
132 pub profile_name: Option<String>,
133 pub message: String,
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
137pub struct RotateCredentialsOutput {
138 #[serde(rename = "tenant_id")]
139 pub tenant: String,
140 pub status: String,
141 pub internal_database_url: String,
142 pub external_database_url: String,
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
146pub struct ProfileSummary {
147 pub name: String,
148 pub has_secrets: bool,
149 pub is_active: bool,
150}
151
152#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
153pub struct ProfileListOutput {
154 pub profiles: Vec<ProfileSummary>,
155 pub total: usize,
156 #[serde(skip_serializing_if = "Option::is_none")]
157 pub active_profile: Option<String>,
158}
159
160#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
161pub struct DeployOutput {
162 pub tenant_name: String,
163 pub image: String,
164 pub status: String,
165 #[serde(skip_serializing_if = "Option::is_none")]
166 pub url: Option<String>,
167 pub secrets_synced: usize,
168 pub cloud_credentials_synced: usize,
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
172pub struct SyncOutput {
173 pub direction: String,
174 pub dry_run: bool,
175 pub operations: Vec<SyncOperationOutput>,
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
179pub struct SyncOperationOutput {
180 pub operation: String,
181 pub success: bool,
182 pub items_synced: usize,
183 pub errors: Vec<String>,
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
187pub struct AdminUserSyncResultOutput {
188 pub profile: String,
189 pub success: bool,
190 #[serde(skip_serializing_if = "Option::is_none")]
191 pub message: Option<String>,
192 #[serde(skip_serializing_if = "Option::is_none")]
193 pub error: Option<String>,
194}
195
196#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
197pub struct AdminUserSyncOutput {
198 pub cloud_user_email: String,
199 pub results: Vec<AdminUserSyncResultOutput>,
200}
201
202#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
203pub struct SkillsSyncOutput {
204 pub direction: String,
205 pub dry_run: bool,
206 pub synced: usize,
207 pub created: usize,
208 pub updated: usize,
209 pub deleted: usize,
210 pub errors: Vec<String>,
211}
212
213#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
214pub struct SecretsOutput {
215 pub operation: String,
216 pub keys: Vec<String>,
217 #[serde(skip_serializing_if = "Option::is_none")]
218 pub rejected_keys: Option<Vec<String>>,
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
222pub struct RestartOutput {
223 pub tenant_name: String,
224 pub status: String,
225}
226
227#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
228pub struct DomainOutput {
229 pub tenant_name: String,
230 pub domain: String,
231 pub status: String,
232 #[serde(skip_serializing_if = "Option::is_none")]
233 pub certificate_status: Option<String>,
234}
235
236#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
237pub struct DockerfileOutput {
238 pub content: String,
239}
240
241#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
242pub struct InitOutput {
243 pub message: String,
244 pub created_paths: Vec<String>,
245}
246
247#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
248pub struct CancelSubscriptionOutput {
249 #[serde(rename = "tenant_id")]
250 pub tenant: String,
251 pub tenant_name: String,
252 pub message: String,
253}