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