koprogo_api/application/dto/
dashboard_dto.rs

1// Application DTOs: Dashboard
2//
3// Data Transfer Objects for dashboard statistics and recent transactions
4
5use chrono::{DateTime, Utc};
6use serde::{Deserialize, Serialize};
7use uuid::Uuid;
8
9/// Accountant dashboard statistics
10#[derive(Debug, Serialize, Deserialize)]
11pub struct AccountantDashboardStats {
12    /// Total expenses for current month
13    pub total_expenses_current_month: f64,
14
15    /// Total paid expenses
16    pub total_paid: f64,
17
18    /// Percentage of expenses paid
19    pub paid_percentage: f64,
20
21    /// Total unpaid/pending expenses
22    pub total_pending: f64,
23
24    /// Percentage of expenses pending
25    pub pending_percentage: f64,
26
27    /// Number of owners with overdue payments
28    pub owners_with_overdue: i64,
29}
30
31/// Transaction type for dashboard display
32///
33/// **Important**: Currently only displays expenses (payments made).
34/// For a complete ACP (Association de Copropriétaires) accounting view, we would need:
35/// - PaymentReceived: Appels de fonds paid by owners (classe 7 PCMN - Produits)
36/// - PaymentMade: Expenses paid to suppliers (classe 6 PCMN - Charges)
37///
38/// **TODO**: Implement owner contributions tracking (appels de fonds) to show incoming payments
39#[derive(Debug, Serialize, Deserialize)]
40#[serde(rename_all = "lowercase")]
41pub enum TransactionType {
42    /// Payment received from owner (appels de fonds) - NOT YET IMPLEMENTED
43    PaymentReceived,
44    /// Payment made to supplier (expenses)
45    PaymentMade,
46}
47
48/// Recent transaction for dashboard
49#[derive(Debug, Serialize, Deserialize)]
50pub struct RecentTransaction {
51    /// Transaction ID
52    pub id: Uuid,
53
54    /// Transaction type
55    pub transaction_type: TransactionType,
56
57    /// Transaction description
58    pub description: String,
59
60    /// Related entity (owner name, supplier, etc.)
61    pub related_entity: Option<String>,
62
63    /// Transaction amount (positive for received, negative for paid)
64    pub amount: f64,
65
66    /// Transaction date
67    pub date: DateTime<Utc>,
68}