1use crate::client::Client;
4use crate::{AccountLite, RecordReference, DDI};
5use serde::{Deserialize, Serialize};
6#[cfg(feature = "openapi")]
7use utoipa::ToSchema;
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
11#[cfg_attr(feature = "openapi", derive(ToSchema))]
12#[cfg_attr(feature = "openapi", schema(
13 title ="Request to fetch user details using authentication token",
14 example = json!({
15 "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
16 })
17))]
18#[serde(rename_all = "camelCase")]
19pub struct UserDetailsRequest {
20 #[cfg_attr(feature = "openapi", schema(example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."))]
22 pub token: String,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(rename_all = "camelCase")]
28#[cfg_attr(feature = "openapi", derive(ToSchema))]
29#[cfg_attr(feature = "openapi", schema(
30 title ="Comprehensive user details including account, device, and agent information",
31 example = json!({
32 "agent_name": "John Doe",
33 "email": "john.doe@example.com",
34 "first_name": "John",
35 "last_name": "Doe",
36 "groups": ["sales", "support"],
37 "account_name": "Acme Corporation",
38 "customers": [
39 {"id": "cust_1", "name": "Customer 1"},
40 {"id": "cust_2", "name": "Customer 2"}
41 ],
42 "softphone_enabled": true,
43 "agent_status": "available",
44 "is_registered": true,
45 "is_available": true
46 })
47))]
48pub struct UserDetailsResponse {
49 #[cfg_attr(feature = "openapi", schema(example = "John Doe"))]
51 pub agent_name: Option<String>,
52
53 #[cfg_attr(feature = "openapi", schema(example = "john.doe@example.com"))]
55 pub email: String,
56
57 #[cfg_attr(feature = "openapi", schema(example = "John"))]
59 pub first_name: String,
60
61 #[cfg_attr(feature = "openapi", schema(example = "Doe"))]
63 pub last_name: String,
64
65 #[cfg_attr(feature = "openapi", schema(example = json!(["sales", "support", "admin"])))]
67 pub groups: Vec<String>,
68
69 #[cfg_attr(feature = "openapi", schema(example = "Acme Corporation"))]
71 pub account_name: String,
72
73 pub customers: Vec<RecordReference>,
75
76 pub agent_settings: Option<crate::AgentSettings>,
78
79 #[cfg_attr(feature = "openapi", schema(example = true))]
81 pub softphone_enabled: bool,
82
83 #[cfg_attr(feature = "openapi", schema(example = "available"))]
85 pub agent_status: Option<String>,
86
87 #[cfg_attr(feature = "openapi", schema(example = true))]
89 pub is_registered: Option<bool>,
90
91 #[cfg_attr(feature = "openapi", schema(example = true))]
93 pub is_available: Option<bool>,
94
95 pub account: Option<AccountLite>,
97
98 pub device: Option<Client>,
100
101 pub ddi: Option<DDI>,
103
104 pub whatsapp: Option<DDI>,
106}