use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AccountType {
Practice,
Real,
Tournament,
Unknown,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AccountBalance {
pub id: i64,
pub currency: String,
pub amount: f64,
pub account_type: AccountType,
pub hold_amount: Option<f64>,
pub bonus_amount: Option<f64>,
pub enrolled_amount: Option<f64>,
pub has_deposits: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Balance {
pub amount: f64,
pub currency: String,
pub account_type: AccountType,
pub balance_id: i64,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn balance_es_clone_y_eq() {
let b = Balance {
amount: 10.0,
currency: "USD".into(),
account_type: AccountType::Practice,
balance_id: 42,
};
let c = b.clone();
assert_eq!(b, c);
assert_eq!(b.balance_id, 42);
}
}