use {
crate::models,
serde::{Deserialize, Serialize},
};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ConversionValidationFailure {
#[serde(rename = "reason")]
pub reason: Reason,
#[serde(rename = "data", skip_serializing_if = "Option::is_none")]
pub data: Option<std::collections::HashMap<String, serde_json::Value>>,
}
impl ConversionValidationFailure {
pub fn new(reason: Reason) -> ConversionValidationFailure {
ConversionValidationFailure { reason, data: None }
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Reason {
#[serde(rename = "ACCOUNT_NOT_FOUND")]
AccountNotFound,
#[serde(rename = "ACCOUNT_TYPE_NOT_SUPPORTED")]
AccountTypeNotSupported,
#[serde(rename = "INSUFFICIENT_BALANCE")]
InsufficientBalance,
#[serde(rename = "ASSET_NOT_FOUND")]
AssetNotFound,
#[serde(rename = "ASSETS_CONTINUITY_MISMATCH")]
AssetsContinuityMismatch,
#[serde(rename = "EXCHANGE_BASKETS_MISMATCH")]
ExchangeBasketsMismatch,
#[serde(rename = "ACCOUNTS_CONTINUITY_MISMATCH")]
AccountsContinuityMismatch,
#[serde(rename = "ONE_TIME_ADDRESS_CONTINUITY_NOT_ALLOWED")]
OneTimeAddressContinuityNotAllowed,
#[serde(rename = "EQUAL_ACCOUNTS_NOT_ALLOWED")]
EqualAccountsNotAllowed,
#[serde(rename = "EQUAL_ASSETS_NOT_ALLOWED")]
EqualAssetsNotAllowed,
#[serde(rename = "INVALID_AMOUNT")]
InvalidAmount,
#[serde(rename = "UNMANAGED_WALLET_AS_SOURCE_NOT_ALLOWED")]
UnmanagedWalletAsSourceNotAllowed,
#[serde(rename = "MANAGED_OPERATION_PARAMS_INVALID_SCHEMA")]
ManagedOperationParamsInvalidSchema,
#[serde(rename = "ACCOUNT_IS_NOT_EXCHANGE")]
AccountIsNotExchange,
#[serde(rename = "UNSUPPORTED_TRADING_METHOD")]
UnsupportedTradingMethod,
#[serde(rename = "ASSETS_CAN_NOT_CONVERTED")]
AssetsCanNotConverted,
}
impl Default for Reason {
fn default() -> Reason {
Self::AccountNotFound
}
}