use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, Clone, Hash, Eq, PartialEq)] pub struct Item { pub name: String, } impl Item { pub fn new(name: &str) -> Self { Self { name: name.to_string(), } } } #[derive(Serialize, Deserialize, Debug, Clone, Hash, Eq, PartialEq)] pub struct ItemListing { pub item: Item, pub price: u32, pub count_per_price: u32, pub restocked_time: DateTime, } impl ItemListing { pub fn new(item: &str, price: u32, count_per_price: u32) -> Self { Self { item: Item { name: item.to_string(), }, price, count_per_price, restocked_time: Utc::now(), } } }