use crate::internal::domain::{AccountId, ErrorCode, GatewayError};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
pub struct PaperTradingConfig {
pub enabled: bool,
pub allowed_accounts: Vec<AccountId>,
}
pub fn validate_paper_trading_config(config: &PaperTradingConfig) -> Result<(), GatewayError> {
if config.enabled && config.allowed_accounts.is_empty() {
return Err(GatewayError::new(
ErrorCode::PaperTradingDisabled,
"Paper trading requires an explicit account allowlist",
false,
Some("Add at least one paper account id to the allowlist".to_string()),
));
}
Ok(())
}