use crate::types::exchange::{
base::{CancelStatus, TwapCancelStatus, TwapOrderStatus},
OrderStatus,
};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Response<T> {
pub status: String,
pub response: ResponseInner<T>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ResponseInner<T> {
Error(String),
Ok(T),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ResponseBody<T> {
#[serde(rename = "type")]
pub type_: String,
pub data: T,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OrderResponseData {
pub statuses: Vec<OrderStatus>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CancelResponseData {
pub statuses: Vec<CancelStatus>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TwapOrderResponseData {
pub status: TwapOrderStatus,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TwapCancelResponseData {
pub status: TwapCancelStatus,
}
pub type OrderResponse = Response<ResponseBody<OrderResponseData>>;
pub type CancelResponse = Response<ResponseBody<CancelResponseData>>;
pub type CancelByCloidResponse = CancelResponse;
pub type ModifyResponse = OrderResponse;
pub type BatchModifyResponse = OrderResponse;
pub type TwapOrderResponse = Response<ResponseBody<TwapOrderResponseData>>;
pub type TwapCancelResponse = Response<ResponseBody<TwapCancelResponseData>>;
pub type DefaultResponse = Response<DefaultResponseBody>;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DefaultResponseBody {
#[serde(rename = "type")]
pub type_: String,
}
pub type ScheduleCancelResponse = DefaultResponse;
pub type UpdateLeverageResponse = DefaultResponse;
pub type UpdateIsolatedMarginResponse = DefaultResponse;
pub type UsdSendResponse = DefaultResponse;
pub type SpotSendResponse = DefaultResponse;
pub type WithdrawResponse = DefaultResponse;
pub type UsdClassTransferResponse = DefaultResponse;
pub type SendAssetResponse = DefaultResponse;
pub type CDepositResponse = DefaultResponse;
pub type CWithdrawResponse = DefaultResponse;
pub type TokenDelegateResponse = DefaultResponse;
pub type VaultTransferResponse = DefaultResponse;
pub type ApproveAgentResponse = DefaultResponse;
pub type ApproveBuilderFeeResponse = DefaultResponse;
pub type ReserveRequestWeightResponse = DefaultResponse;
pub type NoopResponse = DefaultResponse;
pub type UserDexAbstractionResponse = DefaultResponse;
pub type AgentEnableDexAbstractionResponse = DefaultResponse;
pub type ValidatorL1StreamResponse = DefaultResponse;