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