1use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Visitor};
12
13use crate::models;
14#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
16pub enum EventType {
17 User_LoggedIn,
18 User_ChangedPassword,
19 User_Updated2fa,
20 User_Disabled2fa,
21 User_Recovered2fa,
22 User_FailedLogIn,
23 User_FailedLogIn2fa,
24 User_ClientExportedVault,
25 User_UpdatedTempPassword,
26 User_MigratedKeyToKeyConnector,
27 User_RequestedDeviceApproval,
28 User_TdeOffboardingPasswordSet,
29 Cipher_Created,
30 Cipher_Updated,
31 Cipher_Deleted,
32 Cipher_AttachmentCreated,
33 Cipher_AttachmentDeleted,
34 Cipher_Shared,
35 Cipher_UpdatedCollections,
36 Cipher_ClientViewed,
37 Cipher_ClientToggledPasswordVisible,
38 Cipher_ClientToggledHiddenFieldVisible,
39 Cipher_ClientToggledCardCodeVisible,
40 Cipher_ClientCopiedPassword,
41 Cipher_ClientCopiedHiddenField,
42 Cipher_ClientCopiedCardCode,
43 Cipher_ClientAutofilled,
44 Cipher_SoftDeleted,
45 Cipher_Restored,
46 Cipher_ClientToggledCardNumberVisible,
47 Cipher_ClientToggledTOTPSeedVisible,
48 Cipher_ClientCopiedBankAccountNumber,
49 Cipher_ClientCopiedBankAccountPin,
50 Cipher_ClientToggledBankAccountNumberVisible,
51 Cipher_ClientToggledBankAccountPinVisible,
52 Cipher_ClientCopiedLicenseNumber,
53 Cipher_ClientToggledLicenseNumberVisible,
54 Cipher_ClientCopiedPassportNumber,
55 Cipher_ClientToggledPassportNumberVisible,
56 Cipher_ClientCopiedSwiftCode,
57 Cipher_ClientToggledSwiftCodeVisible,
58 Cipher_ClientCopiedIban,
59 Cipher_ClientToggledIbanVisible,
60 Cipher_ClientCopiedNationalIdentificationNumber,
61 Cipher_ClientToggledNationalIdentificationNumberVisible,
62 Collection_Created,
63 Collection_Updated,
64 Collection_Deleted,
65 Group_Created,
66 Group_Updated,
67 Group_Deleted,
68 OrganizationUser_Invited,
69 OrganizationUser_Confirmed,
70 OrganizationUser_Updated,
71 OrganizationUser_Removed,
72 OrganizationUser_UpdatedGroups,
73 OrganizationUser_UnlinkedSso,
74 OrganizationUser_ResetPassword_Enroll,
75 OrganizationUser_ResetPassword_Withdraw,
76 OrganizationUser_AdminResetPassword,
77 OrganizationUser_ResetSsoLink,
78 OrganizationUser_FirstSsoLogin,
79 OrganizationUser_Revoked,
80 OrganizationUser_Restored,
81 OrganizationUser_ApprovedAuthRequest,
82 OrganizationUser_RejectedAuthRequest,
83 OrganizationUser_Deleted,
84 OrganizationUser_Left,
85 OrganizationUser_AutomaticallyConfirmed,
86 OrganizationUser_SelfRevoked,
87 OrganizationUser_AdminResetTwoFactor,
88 OrganizationUser_Revoked_TwoFactorNonCompliance,
89 OrganizationUser_Revoked_SingleOrganizationNonCompliance,
90 OrganizationUser_NotificationBannerActionClicked,
91 OrganizationUser_Staged,
92 OrganizationUser_InviteLinkAccepted,
93 OrganizationUser_AdminChangedEmail,
94 OrganizationUser_InviteLinkConfirmed,
95 Organization_Updated,
96 Organization_PurgedVault,
97 Organization_ClientExportedVault,
98 Organization_VaultAccessed,
99 Organization_EnabledSso,
100 Organization_DisabledSso,
101 Organization_EnabledKeyConnector,
102 Organization_DisabledKeyConnector,
103 Organization_SponsorshipsSynced,
104 Organization_CollectionManagement_Updated,
105 Organization_CollectionManagement_LimitCollectionCreationEnabled,
106 Organization_CollectionManagement_LimitCollectionCreationDisabled,
107 Organization_CollectionManagement_LimitCollectionDeletionEnabled,
108 Organization_CollectionManagement_LimitCollectionDeletionDisabled,
109 Organization_CollectionManagement_LimitItemDeletionEnabled,
110 Organization_CollectionManagement_LimitItemDeletionDisabled,
111 Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled,
112 Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled,
113 Organization_ItemOrganization_Accepted,
114 Organization_ItemOrganization_Declined,
115 Organization_AutoConfirmEnabled_Admin,
116 Organization_AutoConfirmDisabled_Admin,
117 Organization_AutoConfirmEnabled_Portal,
118 Organization_AutoConfirmDisabled_Portal,
119 Organization_InviteLinkCreated,
120 Organization_InviteLinkDomainsEdited,
121 Organization_InviteLinkDeleted,
122 Organization_InviteLinkClientCopied,
123 Organization_InviteLinkRefreshed,
124 Organization_InviteLinkConfirmEnabled,
125 Organization_InviteLinkConfirmDisabled,
126 Policy_Updated,
127 ProviderUser_Invited,
128 ProviderUser_Confirmed,
129 ProviderUser_Updated,
130 ProviderUser_Removed,
131 ProviderOrganization_Created,
132 ProviderOrganization_Added,
133 ProviderOrganization_Removed,
134 ProviderOrganization_VaultAccessed,
135 OrganizationDomain_Added,
136 OrganizationDomain_Removed,
137 OrganizationDomain_Verified,
138 OrganizationDomain_NotVerified,
139 Secret_Retrieved,
140 Secret_Created,
141 Secret_Edited,
142 Secret_Deleted,
143 Secret_Permanently_Deleted,
144 Secret_Restored,
145 Project_Retrieved,
146 Project_Created,
147 Project_Edited,
148 Project_Deleted,
149 ServiceAccount_UserAdded,
150 ServiceAccount_UserRemoved,
151 ServiceAccount_GroupAdded,
152 ServiceAccount_GroupRemoved,
153 ServiceAccount_Created,
154 ServiceAccount_Deleted,
155 PhishingBlocker_SiteAccessed,
156 PhishingBlocker_SiteExited,
157 PhishingBlocker_Bypassed,
158 Send_Created_Text,
159 Send_Created_Text_WithEmailVerification,
160 Send_Created_Text_WithPasswordProtection,
161 Send_Created_File,
162 Send_Created_File_WithEmailVerification,
163 Send_Created_File_WithPasswordProtection,
164 Send_Edited_Text,
165 Send_Edited_File,
166 Send_Deleted_Text,
167 Send_Deleted_File,
168 Send_Accessed_Text,
169 Send_Accessed_File,
170
171 __Unknown(i64),
173}
174
175impl EventType {
176 pub fn as_i64(&self) -> i64 {
177 match self {
178 Self::User_LoggedIn => 1000,
179 Self::User_ChangedPassword => 1001,
180 Self::User_Updated2fa => 1002,
181 Self::User_Disabled2fa => 1003,
182 Self::User_Recovered2fa => 1004,
183 Self::User_FailedLogIn => 1005,
184 Self::User_FailedLogIn2fa => 1006,
185 Self::User_ClientExportedVault => 1007,
186 Self::User_UpdatedTempPassword => 1008,
187 Self::User_MigratedKeyToKeyConnector => 1009,
188 Self::User_RequestedDeviceApproval => 1010,
189 Self::User_TdeOffboardingPasswordSet => 1011,
190 Self::Cipher_Created => 1100,
191 Self::Cipher_Updated => 1101,
192 Self::Cipher_Deleted => 1102,
193 Self::Cipher_AttachmentCreated => 1103,
194 Self::Cipher_AttachmentDeleted => 1104,
195 Self::Cipher_Shared => 1105,
196 Self::Cipher_UpdatedCollections => 1106,
197 Self::Cipher_ClientViewed => 1107,
198 Self::Cipher_ClientToggledPasswordVisible => 1108,
199 Self::Cipher_ClientToggledHiddenFieldVisible => 1109,
200 Self::Cipher_ClientToggledCardCodeVisible => 1110,
201 Self::Cipher_ClientCopiedPassword => 1111,
202 Self::Cipher_ClientCopiedHiddenField => 1112,
203 Self::Cipher_ClientCopiedCardCode => 1113,
204 Self::Cipher_ClientAutofilled => 1114,
205 Self::Cipher_SoftDeleted => 1115,
206 Self::Cipher_Restored => 1116,
207 Self::Cipher_ClientToggledCardNumberVisible => 1117,
208 Self::Cipher_ClientToggledTOTPSeedVisible => 1118,
209 Self::Cipher_ClientCopiedBankAccountNumber => 1119,
210 Self::Cipher_ClientCopiedBankAccountPin => 1120,
211 Self::Cipher_ClientToggledBankAccountNumberVisible => 1121,
212 Self::Cipher_ClientToggledBankAccountPinVisible => 1122,
213 Self::Cipher_ClientCopiedLicenseNumber => 1123,
214 Self::Cipher_ClientToggledLicenseNumberVisible => 1124,
215 Self::Cipher_ClientCopiedPassportNumber => 1125,
216 Self::Cipher_ClientToggledPassportNumberVisible => 1126,
217 Self::Cipher_ClientCopiedSwiftCode => 1127,
218 Self::Cipher_ClientToggledSwiftCodeVisible => 1128,
219 Self::Cipher_ClientCopiedIban => 1129,
220 Self::Cipher_ClientToggledIbanVisible => 1130,
221 Self::Cipher_ClientCopiedNationalIdentificationNumber => 1131,
222 Self::Cipher_ClientToggledNationalIdentificationNumberVisible => 1132,
223 Self::Collection_Created => 1300,
224 Self::Collection_Updated => 1301,
225 Self::Collection_Deleted => 1302,
226 Self::Group_Created => 1400,
227 Self::Group_Updated => 1401,
228 Self::Group_Deleted => 1402,
229 Self::OrganizationUser_Invited => 1500,
230 Self::OrganizationUser_Confirmed => 1501,
231 Self::OrganizationUser_Updated => 1502,
232 Self::OrganizationUser_Removed => 1503,
233 Self::OrganizationUser_UpdatedGroups => 1504,
234 Self::OrganizationUser_UnlinkedSso => 1505,
235 Self::OrganizationUser_ResetPassword_Enroll => 1506,
236 Self::OrganizationUser_ResetPassword_Withdraw => 1507,
237 Self::OrganizationUser_AdminResetPassword => 1508,
238 Self::OrganizationUser_ResetSsoLink => 1509,
239 Self::OrganizationUser_FirstSsoLogin => 1510,
240 Self::OrganizationUser_Revoked => 1511,
241 Self::OrganizationUser_Restored => 1512,
242 Self::OrganizationUser_ApprovedAuthRequest => 1513,
243 Self::OrganizationUser_RejectedAuthRequest => 1514,
244 Self::OrganizationUser_Deleted => 1515,
245 Self::OrganizationUser_Left => 1516,
246 Self::OrganizationUser_AutomaticallyConfirmed => 1517,
247 Self::OrganizationUser_SelfRevoked => 1518,
248 Self::OrganizationUser_AdminResetTwoFactor => 1519,
249 Self::OrganizationUser_Revoked_TwoFactorNonCompliance => 1520,
250 Self::OrganizationUser_Revoked_SingleOrganizationNonCompliance => 1521,
251 Self::OrganizationUser_NotificationBannerActionClicked => 1522,
252 Self::OrganizationUser_Staged => 1523,
253 Self::OrganizationUser_InviteLinkAccepted => 1524,
254 Self::OrganizationUser_AdminChangedEmail => 1525,
255 Self::OrganizationUser_InviteLinkConfirmed => 1526,
256 Self::Organization_Updated => 1600,
257 Self::Organization_PurgedVault => 1601,
258 Self::Organization_ClientExportedVault => 1602,
259 Self::Organization_VaultAccessed => 1603,
260 Self::Organization_EnabledSso => 1604,
261 Self::Organization_DisabledSso => 1605,
262 Self::Organization_EnabledKeyConnector => 1606,
263 Self::Organization_DisabledKeyConnector => 1607,
264 Self::Organization_SponsorshipsSynced => 1608,
265 Self::Organization_CollectionManagement_Updated => 1609,
266 Self::Organization_CollectionManagement_LimitCollectionCreationEnabled => 1610,
267 Self::Organization_CollectionManagement_LimitCollectionCreationDisabled => 1611,
268 Self::Organization_CollectionManagement_LimitCollectionDeletionEnabled => 1612,
269 Self::Organization_CollectionManagement_LimitCollectionDeletionDisabled => 1613,
270 Self::Organization_CollectionManagement_LimitItemDeletionEnabled => 1614,
271 Self::Organization_CollectionManagement_LimitItemDeletionDisabled => 1615,
272 Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled => 1616,
273 Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled => 1617,
274 Self::Organization_ItemOrganization_Accepted => 1618,
275 Self::Organization_ItemOrganization_Declined => 1619,
276 Self::Organization_AutoConfirmEnabled_Admin => 1620,
277 Self::Organization_AutoConfirmDisabled_Admin => 1621,
278 Self::Organization_AutoConfirmEnabled_Portal => 1622,
279 Self::Organization_AutoConfirmDisabled_Portal => 1623,
280 Self::Organization_InviteLinkCreated => 1624,
281 Self::Organization_InviteLinkDomainsEdited => 1625,
282 Self::Organization_InviteLinkDeleted => 1626,
283 Self::Organization_InviteLinkClientCopied => 1627,
284 Self::Organization_InviteLinkRefreshed => 1628,
285 Self::Organization_InviteLinkConfirmEnabled => 1629,
286 Self::Organization_InviteLinkConfirmDisabled => 1630,
287 Self::Policy_Updated => 1700,
288 Self::ProviderUser_Invited => 1800,
289 Self::ProviderUser_Confirmed => 1801,
290 Self::ProviderUser_Updated => 1802,
291 Self::ProviderUser_Removed => 1803,
292 Self::ProviderOrganization_Created => 1900,
293 Self::ProviderOrganization_Added => 1901,
294 Self::ProviderOrganization_Removed => 1902,
295 Self::ProviderOrganization_VaultAccessed => 1903,
296 Self::OrganizationDomain_Added => 2000,
297 Self::OrganizationDomain_Removed => 2001,
298 Self::OrganizationDomain_Verified => 2002,
299 Self::OrganizationDomain_NotVerified => 2003,
300 Self::Secret_Retrieved => 2100,
301 Self::Secret_Created => 2101,
302 Self::Secret_Edited => 2102,
303 Self::Secret_Deleted => 2103,
304 Self::Secret_Permanently_Deleted => 2104,
305 Self::Secret_Restored => 2105,
306 Self::Project_Retrieved => 2200,
307 Self::Project_Created => 2201,
308 Self::Project_Edited => 2202,
309 Self::Project_Deleted => 2203,
310 Self::ServiceAccount_UserAdded => 2300,
311 Self::ServiceAccount_UserRemoved => 2301,
312 Self::ServiceAccount_GroupAdded => 2302,
313 Self::ServiceAccount_GroupRemoved => 2303,
314 Self::ServiceAccount_Created => 2304,
315 Self::ServiceAccount_Deleted => 2305,
316 Self::PhishingBlocker_SiteAccessed => 2400,
317 Self::PhishingBlocker_SiteExited => 2401,
318 Self::PhishingBlocker_Bypassed => 2402,
319 Self::Send_Created_Text => 2500,
320 Self::Send_Created_Text_WithEmailVerification => 2501,
321 Self::Send_Created_Text_WithPasswordProtection => 2502,
322 Self::Send_Created_File => 2503,
323 Self::Send_Created_File_WithEmailVerification => 2504,
324 Self::Send_Created_File_WithPasswordProtection => 2505,
325 Self::Send_Edited_Text => 2506,
326 Self::Send_Edited_File => 2507,
327 Self::Send_Deleted_Text => 2508,
328 Self::Send_Deleted_File => 2509,
329 Self::Send_Accessed_Text => 2510,
330 Self::Send_Accessed_File => 2511,
331 Self::__Unknown(v) => *v,
332 }
333 }
334
335 pub fn from_i64(value: i64) -> Self {
336 match value {
337 1000 => Self::User_LoggedIn,
338 1001 => Self::User_ChangedPassword,
339 1002 => Self::User_Updated2fa,
340 1003 => Self::User_Disabled2fa,
341 1004 => Self::User_Recovered2fa,
342 1005 => Self::User_FailedLogIn,
343 1006 => Self::User_FailedLogIn2fa,
344 1007 => Self::User_ClientExportedVault,
345 1008 => Self::User_UpdatedTempPassword,
346 1009 => Self::User_MigratedKeyToKeyConnector,
347 1010 => Self::User_RequestedDeviceApproval,
348 1011 => Self::User_TdeOffboardingPasswordSet,
349 1100 => Self::Cipher_Created,
350 1101 => Self::Cipher_Updated,
351 1102 => Self::Cipher_Deleted,
352 1103 => Self::Cipher_AttachmentCreated,
353 1104 => Self::Cipher_AttachmentDeleted,
354 1105 => Self::Cipher_Shared,
355 1106 => Self::Cipher_UpdatedCollections,
356 1107 => Self::Cipher_ClientViewed,
357 1108 => Self::Cipher_ClientToggledPasswordVisible,
358 1109 => Self::Cipher_ClientToggledHiddenFieldVisible,
359 1110 => Self::Cipher_ClientToggledCardCodeVisible,
360 1111 => Self::Cipher_ClientCopiedPassword,
361 1112 => Self::Cipher_ClientCopiedHiddenField,
362 1113 => Self::Cipher_ClientCopiedCardCode,
363 1114 => Self::Cipher_ClientAutofilled,
364 1115 => Self::Cipher_SoftDeleted,
365 1116 => Self::Cipher_Restored,
366 1117 => Self::Cipher_ClientToggledCardNumberVisible,
367 1118 => Self::Cipher_ClientToggledTOTPSeedVisible,
368 1119 => Self::Cipher_ClientCopiedBankAccountNumber,
369 1120 => Self::Cipher_ClientCopiedBankAccountPin,
370 1121 => Self::Cipher_ClientToggledBankAccountNumberVisible,
371 1122 => Self::Cipher_ClientToggledBankAccountPinVisible,
372 1123 => Self::Cipher_ClientCopiedLicenseNumber,
373 1124 => Self::Cipher_ClientToggledLicenseNumberVisible,
374 1125 => Self::Cipher_ClientCopiedPassportNumber,
375 1126 => Self::Cipher_ClientToggledPassportNumberVisible,
376 1127 => Self::Cipher_ClientCopiedSwiftCode,
377 1128 => Self::Cipher_ClientToggledSwiftCodeVisible,
378 1129 => Self::Cipher_ClientCopiedIban,
379 1130 => Self::Cipher_ClientToggledIbanVisible,
380 1131 => Self::Cipher_ClientCopiedNationalIdentificationNumber,
381 1132 => Self::Cipher_ClientToggledNationalIdentificationNumberVisible,
382 1300 => Self::Collection_Created,
383 1301 => Self::Collection_Updated,
384 1302 => Self::Collection_Deleted,
385 1400 => Self::Group_Created,
386 1401 => Self::Group_Updated,
387 1402 => Self::Group_Deleted,
388 1500 => Self::OrganizationUser_Invited,
389 1501 => Self::OrganizationUser_Confirmed,
390 1502 => Self::OrganizationUser_Updated,
391 1503 => Self::OrganizationUser_Removed,
392 1504 => Self::OrganizationUser_UpdatedGroups,
393 1505 => Self::OrganizationUser_UnlinkedSso,
394 1506 => Self::OrganizationUser_ResetPassword_Enroll,
395 1507 => Self::OrganizationUser_ResetPassword_Withdraw,
396 1508 => Self::OrganizationUser_AdminResetPassword,
397 1509 => Self::OrganizationUser_ResetSsoLink,
398 1510 => Self::OrganizationUser_FirstSsoLogin,
399 1511 => Self::OrganizationUser_Revoked,
400 1512 => Self::OrganizationUser_Restored,
401 1513 => Self::OrganizationUser_ApprovedAuthRequest,
402 1514 => Self::OrganizationUser_RejectedAuthRequest,
403 1515 => Self::OrganizationUser_Deleted,
404 1516 => Self::OrganizationUser_Left,
405 1517 => Self::OrganizationUser_AutomaticallyConfirmed,
406 1518 => Self::OrganizationUser_SelfRevoked,
407 1519 => Self::OrganizationUser_AdminResetTwoFactor,
408 1520 => Self::OrganizationUser_Revoked_TwoFactorNonCompliance,
409 1521 => Self::OrganizationUser_Revoked_SingleOrganizationNonCompliance,
410 1522 => Self::OrganizationUser_NotificationBannerActionClicked,
411 1523 => Self::OrganizationUser_Staged,
412 1524 => Self::OrganizationUser_InviteLinkAccepted,
413 1525 => Self::OrganizationUser_AdminChangedEmail,
414 1526 => Self::OrganizationUser_InviteLinkConfirmed,
415 1600 => Self::Organization_Updated,
416 1601 => Self::Organization_PurgedVault,
417 1602 => Self::Organization_ClientExportedVault,
418 1603 => Self::Organization_VaultAccessed,
419 1604 => Self::Organization_EnabledSso,
420 1605 => Self::Organization_DisabledSso,
421 1606 => Self::Organization_EnabledKeyConnector,
422 1607 => Self::Organization_DisabledKeyConnector,
423 1608 => Self::Organization_SponsorshipsSynced,
424 1609 => Self::Organization_CollectionManagement_Updated,
425 1610 => Self::Organization_CollectionManagement_LimitCollectionCreationEnabled,
426 1611 => Self::Organization_CollectionManagement_LimitCollectionCreationDisabled,
427 1612 => Self::Organization_CollectionManagement_LimitCollectionDeletionEnabled,
428 1613 => Self::Organization_CollectionManagement_LimitCollectionDeletionDisabled,
429 1614 => Self::Organization_CollectionManagement_LimitItemDeletionEnabled,
430 1615 => Self::Organization_CollectionManagement_LimitItemDeletionDisabled,
431 1616 => {
432 Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled
433 }
434 1617 => {
435 Self::Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled
436 }
437 1618 => Self::Organization_ItemOrganization_Accepted,
438 1619 => Self::Organization_ItemOrganization_Declined,
439 1620 => Self::Organization_AutoConfirmEnabled_Admin,
440 1621 => Self::Organization_AutoConfirmDisabled_Admin,
441 1622 => Self::Organization_AutoConfirmEnabled_Portal,
442 1623 => Self::Organization_AutoConfirmDisabled_Portal,
443 1624 => Self::Organization_InviteLinkCreated,
444 1625 => Self::Organization_InviteLinkDomainsEdited,
445 1626 => Self::Organization_InviteLinkDeleted,
446 1627 => Self::Organization_InviteLinkClientCopied,
447 1628 => Self::Organization_InviteLinkRefreshed,
448 1629 => Self::Organization_InviteLinkConfirmEnabled,
449 1630 => Self::Organization_InviteLinkConfirmDisabled,
450 1700 => Self::Policy_Updated,
451 1800 => Self::ProviderUser_Invited,
452 1801 => Self::ProviderUser_Confirmed,
453 1802 => Self::ProviderUser_Updated,
454 1803 => Self::ProviderUser_Removed,
455 1900 => Self::ProviderOrganization_Created,
456 1901 => Self::ProviderOrganization_Added,
457 1902 => Self::ProviderOrganization_Removed,
458 1903 => Self::ProviderOrganization_VaultAccessed,
459 2000 => Self::OrganizationDomain_Added,
460 2001 => Self::OrganizationDomain_Removed,
461 2002 => Self::OrganizationDomain_Verified,
462 2003 => Self::OrganizationDomain_NotVerified,
463 2100 => Self::Secret_Retrieved,
464 2101 => Self::Secret_Created,
465 2102 => Self::Secret_Edited,
466 2103 => Self::Secret_Deleted,
467 2104 => Self::Secret_Permanently_Deleted,
468 2105 => Self::Secret_Restored,
469 2200 => Self::Project_Retrieved,
470 2201 => Self::Project_Created,
471 2202 => Self::Project_Edited,
472 2203 => Self::Project_Deleted,
473 2300 => Self::ServiceAccount_UserAdded,
474 2301 => Self::ServiceAccount_UserRemoved,
475 2302 => Self::ServiceAccount_GroupAdded,
476 2303 => Self::ServiceAccount_GroupRemoved,
477 2304 => Self::ServiceAccount_Created,
478 2305 => Self::ServiceAccount_Deleted,
479 2400 => Self::PhishingBlocker_SiteAccessed,
480 2401 => Self::PhishingBlocker_SiteExited,
481 2402 => Self::PhishingBlocker_Bypassed,
482 2500 => Self::Send_Created_Text,
483 2501 => Self::Send_Created_Text_WithEmailVerification,
484 2502 => Self::Send_Created_Text_WithPasswordProtection,
485 2503 => Self::Send_Created_File,
486 2504 => Self::Send_Created_File_WithEmailVerification,
487 2505 => Self::Send_Created_File_WithPasswordProtection,
488 2506 => Self::Send_Edited_Text,
489 2507 => Self::Send_Edited_File,
490 2508 => Self::Send_Deleted_Text,
491 2509 => Self::Send_Deleted_File,
492 2510 => Self::Send_Accessed_Text,
493 2511 => Self::Send_Accessed_File,
494 v => Self::__Unknown(v),
495 }
496 }
497}
498
499impl serde::Serialize for EventType {
500 fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
501 serializer.serialize_i64(self.as_i64())
502 }
503}
504
505impl<'de> serde::Deserialize<'de> for EventType {
506 fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
507 struct EventTypeVisitor;
508
509 impl Visitor<'_> for EventTypeVisitor {
510 type Value = EventType;
511
512 fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
513 f.write_str("an integer")
514 }
515
516 fn visit_i64<E: serde::de::Error>(self, v: i64) -> Result<Self::Value, E> {
517 Ok(EventType::from_i64(v))
518 }
519
520 fn visit_u64<E: serde::de::Error>(self, v: u64) -> Result<Self::Value, E> {
521 Ok(EventType::from_i64(v as i64))
522 }
523 }
524
525 deserializer.deserialize_i64(EventTypeVisitor)
526 }
527}
528
529impl std::fmt::Display for EventType {
530 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
531 write!(f, "{}", self.as_i64())
532 }
533}
534impl Default for EventType {
535 fn default() -> EventType {
536 Self::User_LoggedIn
537 }
538}