use chrono::{DateTime, Utc};
use log::debug;
use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct DamageLog {
timestamp: DateTime<Utc>,
damage: isize,
other_player: String,
other_ship: String,
weapon: String,
destination: Destination,
}
impl DamageLog {
pub fn new(
timestamp: DateTime<Utc>,
damage: isize,
other_player: String,
other_ship: String,
weapon: String,
destination: Destination,
) -> Self {
debug!(
"Creating a new damagelog ({},{},{},{},{},{:?})",
timestamp, damage, other_player, other_ship, weapon, destination
);
DamageLog {
timestamp,
damage,
other_player,
other_ship,
weapon,
destination,
}
}
}
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct LogiLog {
timestamp: DateTime<Utc>,
amount: isize,
other_player: String,
other_ship: String,
rep_type: String,
destination: Destination,
}
impl LogiLog {
pub fn new(
timestamp: DateTime<Utc>,
amount: isize,
other_player: String,
other_ship: String,
rep_type: String,
destination: Destination,
) -> Self {
debug!(
"Creating a new damagelog ({},{},{},{},{},{:?})",
timestamp, amount, other_player, other_ship, rep_type, destination
);
LogiLog {
timestamp,
amount,
other_player,
other_ship,
rep_type,
destination,
}
}
}
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Destination {
Receiving,
Dealing,
}
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Log {
Damage(DamageLog),
Logi(LogiLog),
}