use serde::{Deserialize, Serialize};
use rust_decimal::Decimal;
use chrono::{DateTime, Utc};
use std::collections::HashMap;
use super::{CurrencyAmounts, PageDetails, ApiErrorDetail};
#[derive(Debug, Deserialize, Serialize)]
pub struct AccountInfoDetails {
pub username: String,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct FidorReservation {
#[serde(with = "rust_decimal::serde::str")]
pub total_amount: Decimal,
#[serde(with = "rust_decimal::serde::str")]
pub available_amount: Decimal,
#[serde(rename = "reserved_at")]
pub reserved_at: DateTime<Utc>,
#[serde(rename = "valid_until")]
pub valid_until: DateTime<Utc>,
pub allocation: HashMap<String, FidorAllocation>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct FidorAllocation {
pub percent: i32, #[serde(with = "rust_decimal::serde::str")]
pub max_eur_volume: Decimal, #[serde(rename = "eur_volume_open_orders")]
#[serde(with = "rust_decimal::serde::str")]
pub eur_volume_open_orders: Decimal, }
#[derive(Debug, Deserialize, Serialize)]
pub struct EncryptedInformation {
#[serde(rename = "bic_short")]
pub bic_short: Option<String>, #[serde(rename = "bic_full")]
pub bic_full: Option<String>, pub uid: String, }
#[derive(Debug, Deserialize, Serialize)]
pub struct ShowAccountInfoResponse {
pub data: ShowAccountInfoData, pub errors: Vec<ApiErrorDetail>, pub credits: i32,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct ShowAccountInfoData {
pub balances: AccountBalances, #[serde(rename = "encrypted_information")]
pub encrypted_information: EncryptedInformation, }
#[derive(Debug, Deserialize, Serialize)]
pub struct AccountBalances {
#[serde(flatten)] pub crypto_balances: HashMap<String, DetailedBalanceAmounts>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct DetailedBalanceAmounts {
#[serde(rename = "total_amount")]
#[serde(with = "rust_decimal::serde::str")]
pub total_amount: Decimal,
#[serde(rename = "available_amount")]
#[serde(with = "rust_decimal::serde::str")]
pub available_amount: Decimal,
#[serde(rename = "reserved_amount")]
#[serde(with = "rust_decimal::serde::str")]
pub reserved_amount: Decimal,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct LedgerEntry {
#[serde(rename = "date")]
pub date: DateTime<Utc>, #[serde(rename = "type")] pub entry_type: String, pub reference: String, #[serde(rename = "trade")]
pub trade_details: Option<LedgerTradeDetails>, #[serde(with = "rust_decimal::serde::str")] pub cashflow: Decimal, #[serde(with = "rust_decimal::serde::str")] pub balance: Decimal, }
#[derive(Debug, Deserialize, Serialize)]
pub struct LedgerTradeDetails {
#[serde(rename = "trade_id")]
pub trade_id: String,
#[serde(rename = "trading_pair")]
pub trading_pair: String,
#[serde(with = "rust_decimal::serde::str")] pub price: Decimal,
#[serde(rename = "is_external_wallet_trade")]
pub is_external_wallet_trade: bool,
#[serde(rename = "primary_currency")]
pub primary_currency: HashMap<String, CurrencyAmounts>,
#[serde(rename = "secondary_currency")]
pub secondary_currency: HashMap<String, CurrencyAmounts>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct ShowAccountLedgerResponse {
#[serde(rename = "account_ledger")]
pub account_ledger: Vec<LedgerEntry>,
pub page: PageDetails,
pub errors: Vec<ApiErrorDetail>,
pub credits: i32,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct ShowPermissionsResponse {
pub permissions: Vec<String>, pub errors: Vec<ApiErrorDetail>,
pub credits: i32,
}