use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};
use crate::SpotMarginMode;
#[derive(Debug, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SwitchSpotMarginModeRequest {
pub spot_margin_mode: SpotMarginMode,
}
impl SwitchSpotMarginModeRequest {
pub fn enable() -> Self {
Self {
spot_margin_mode: SpotMarginMode::Enabled,
}
}
pub fn disable() -> Self {
Self {
spot_margin_mode: SpotMarginMode::Disabled,
}
}
}
#[derive(Debug, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SwitchSpotMarginModeResult {
pub spot_margin_mode: SpotMarginMode,
}
#[derive(Debug, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SetSpotMarginLeverageRequest {
pub leverage: Decimal,
#[serde(skip_serializing_if = "Option::is_none")]
pub currency: Option<String>,
}
impl SetSpotMarginLeverageRequest {
pub fn new(leverage: Decimal) -> Self {
Self {
leverage,
currency: None,
}
}
pub fn with_currency(mut self, v: impl Into<String>) -> Self {
self.currency = Some(v.into());
self
}
}