use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MarketTransaction {
#[serde(rename = "waypointSymbol")]
pub waypoint_symbol: String,
#[serde(rename = "shipSymbol")]
pub ship_symbol: String,
#[serde(rename = "tradeSymbol")]
pub trade_symbol: String,
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "units")]
pub units: u32,
#[serde(rename = "pricePerUnit")]
pub price_per_unit: u32,
#[serde(rename = "totalPrice")]
pub total_price: u32,
#[serde(rename = "timestamp")]
pub timestamp: String,
}
impl MarketTransaction {
#[allow(clippy::too_many_arguments)]
pub fn new(
waypoint_symbol: String,
ship_symbol: String,
trade_symbol: String,
r#type: Type,
units: u32,
price_per_unit: u32,
total_price: u32,
timestamp: String,
) -> MarketTransaction {
MarketTransaction {
waypoint_symbol,
ship_symbol,
trade_symbol,
r#type,
units,
price_per_unit,
total_price,
timestamp,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "PURCHASE")]
Purchase,
#[serde(rename = "SELL")]
Sell,
}
impl Default for Type {
fn default() -> Type {
Self::Purchase
}
}