cripsy_binary_api/domain/
account.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6pub enum AccountType {
7 Practice,
8 Real,
9 Tournament,
10 Unknown,
14}
15
16#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
22pub struct AccountBalance {
23 pub id: i64,
25 pub currency: String,
26 pub amount: f64,
27 pub account_type: AccountType,
28 pub hold_amount: Option<f64>,
30 pub bonus_amount: Option<f64>,
32 pub enrolled_amount: Option<f64>,
34 pub has_deposits: Option<bool>,
36}
37
38#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
40pub struct Balance {
41 pub amount: f64,
42 pub currency: String,
43 pub account_type: AccountType,
44 pub balance_id: i64,
45}
46
47#[cfg(test)]
48mod tests {
49 use super::*;
50
51 #[test]
52 fn balance_es_clone_y_eq() {
53 let b = Balance {
54 amount: 10.0,
55 currency: "USD".into(),
56 account_type: AccountType::Practice,
57 balance_id: 42,
58 };
59 let c = b.clone();
60 assert_eq!(b, c);
61 assert_eq!(b.balance_id, 42);
62 }
63}