use crate::{
commands::{
command::Command, enqueue_order_command::EnqueueOrderCommand, if_command::IfCommand,
list_command::ListCommand, no_op_command::NoOpCommand,
},
conditions::condition::Condition,
order::order_request::OrderRequest,
values::value::{AssetIdValue, ExchangeIdValue, NumberValue},
};
pub struct CommandFactory;
impl CommandFactory {
pub fn if_else(&self, condition: Condition, if_true: Command, if_false: Command) -> Command {
IfCommand::new(condition, if_true, if_false)
}
pub fn list(&self, commands: Vec<Command>) -> Command {
ListCommand::new(commands)
}
pub fn no_op(&self) -> Command {
NoOpCommand::new()
}
pub fn enqueue_order(
&self,
exchange_id_value: ExchangeIdValue,
order_request: OrderRequest<AssetIdValue, NumberValue>,
) -> Command {
EnqueueOrderCommand::new(exchange_id_value, order_request)
}
}