space_traders/models/
market_trade_good.rs

1//! Generated by: <https://openapi-generator.tech>
2//!
3//! Version of specification: `2.0.0`
4
5use serde::{Deserialize, Serialize};
6
7///
8#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9pub struct MarketTradeGood {
10    /// The symbol of the trade good.
11    #[serde(rename = "symbol")]
12    pub symbol: String,
13    /// The typical volume flowing through the market for this type of good. The larger the trade volume, the more stable prices will be.
14    #[serde(rename = "tradeVolume")]
15    pub trade_volume: u32,
16    /// A rough estimate of the total supply of this good in the marketplace.
17    #[serde(rename = "supply")]
18    pub supply: Supply,
19    /// The price at which this good can be purchased from the market.
20    #[serde(rename = "purchasePrice")]
21    pub purchase_price: u32,
22    /// The price at which this good can be sold to the market.
23    #[serde(rename = "sellPrice")]
24    pub sell_price: u32,
25}
26
27impl MarketTradeGood {
28    /// Create value with optional fields set to `None`.
29    #[allow(clippy::too_many_arguments)]
30    pub fn new(
31        symbol: String,
32        trade_volume: u32,
33        supply: Supply,
34        purchase_price: u32,
35        sell_price: u32,
36    ) -> MarketTradeGood {
37        MarketTradeGood {
38            symbol,
39            trade_volume,
40            supply,
41            purchase_price,
42            sell_price,
43        }
44    }
45}
46
47/// A rough estimate of the total supply of this good in the marketplace.
48#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
49pub enum Supply {
50    #[serde(rename = "SCARCE")]
51    Scarce,
52    #[serde(rename = "LIMITED")]
53    Limited,
54    #[serde(rename = "MODERATE")]
55    Moderate,
56    #[serde(rename = "ABUNDANT")]
57    Abundant,
58}
59
60impl Default for Supply {
61    fn default() -> Supply {
62        Self::Scarce
63    }
64}