use crate::client::Client;
use crate::{AccountLite, RecordReference, DDI};
use serde::{Deserialize, Serialize};
#[cfg(feature = "openapi")]
use utoipa::ToSchema;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "openapi", derive(ToSchema))]
#[cfg_attr(feature = "openapi", schema(
title ="Request to fetch user details using authentication token",
example = json!({
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
})
))]
#[serde(rename_all = "camelCase")]
pub struct UserDetailsRequest {
#[cfg_attr(feature = "openapi", schema(example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."))]
pub token: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "openapi", derive(ToSchema))]
#[cfg_attr(feature = "openapi", schema(
title ="Comprehensive user details including account, device, and agent information",
example = json!({
"agent_name": "John Doe",
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"groups": ["sales", "support"],
"account_name": "Acme Corporation",
"customers": [
{"id": "cust_1", "name": "Customer 1"},
{"id": "cust_2", "name": "Customer 2"}
],
"softphone_enabled": true,
"agent_status": "available",
"is_registered": true,
"is_available": true
})
))]
pub struct UserDetailsResponse {
#[cfg_attr(feature = "openapi", schema(example = "John Doe"))]
pub agent_name: Option<String>,
#[cfg_attr(feature = "openapi", schema(example = "john.doe@example.com"))]
pub email: String,
#[cfg_attr(feature = "openapi", schema(example = "John"))]
pub first_name: String,
#[cfg_attr(feature = "openapi", schema(example = "Doe"))]
pub last_name: String,
#[cfg_attr(feature = "openapi", schema(example = json!(["sales", "support", "admin"])))]
pub groups: Vec<String>,
#[cfg_attr(feature = "openapi", schema(example = "Acme Corporation"))]
pub account_name: String,
pub customers: Vec<RecordReference>,
pub agent_settings: Option<crate::AgentSettings>,
#[cfg_attr(feature = "openapi", schema(example = true))]
pub softphone_enabled: bool,
#[cfg_attr(feature = "openapi", schema(example = "available"))]
pub agent_status: Option<String>,
#[cfg_attr(feature = "openapi", schema(example = true))]
pub is_registered: Option<bool>,
#[cfg_attr(feature = "openapi", schema(example = true))]
pub is_available: Option<bool>,
pub account: Option<AccountLite>,
pub device: Option<Client>,
pub ddi: Option<DDI>,
pub whatsapp: Option<DDI>,
}