Skip to content

Commit b29d04e

Browse files
committed
feat(types): add statistics API types
1 parent c9a4ca0 commit b29d04e

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

rustmail_types/src/api/mod.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,60 @@ pub struct Snippet {
3232
pub created_at: String,
3333
pub updated_at: String,
3434
}
35+
36+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
37+
pub struct StatisticsOverview {
38+
pub open_tickets: i64,
39+
pub total_closed: i64,
40+
pub closed_today: i64,
41+
pub closed_this_week: i64,
42+
pub closed_this_month: i64,
43+
pub avg_response_time_seconds: Option<i64>,
44+
pub avg_resolution_time_seconds: Option<i64>,
45+
}
46+
47+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
48+
pub struct DailyActivity {
49+
pub date: String,
50+
pub created: i64,
51+
pub closed: i64,
52+
}
53+
54+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
55+
pub struct CategoryStats {
56+
pub name: String,
57+
pub count: i64,
58+
pub percentage: f64,
59+
}
60+
61+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
62+
pub struct StaffMember {
63+
pub user_id: String,
64+
pub username: String,
65+
pub messages_count: i64,
66+
pub tickets_closed: i64,
67+
pub avg_response_time_seconds: Option<i64>,
68+
}
69+
70+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
71+
pub struct TopPerformer {
72+
pub user_id: String,
73+
pub username: String,
74+
pub value: i64,
75+
}
76+
77+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
78+
pub struct TopPerformers {
79+
pub fastest_responder: Option<TopPerformer>,
80+
pub most_messages: Option<TopPerformer>,
81+
pub most_tickets_closed: Option<TopPerformer>,
82+
}
83+
84+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
85+
pub struct Statistics {
86+
pub overview: StatisticsOverview,
87+
pub activity: Vec<DailyActivity>,
88+
pub categories: Vec<CategoryStats>,
89+
pub staff_leaderboard: Vec<StaffMember>,
90+
pub top_performers: TopPerformers,
91+
}

0 commit comments

Comments
 (0)