space_traders/models/
ship_engine.rs

1//! Generated by: <https://openapi-generator.tech>
2//!
3//! Version of specification: `2.0.0`
4
5use serde::{Deserialize, Serialize};
6
7/// The engine determines how quickly a ship travels between waypoints.
8#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9pub struct ShipEngine {
10    /// The symbol of the engine.
11    #[serde(rename = "symbol")]
12    pub symbol: Symbol,
13    /// The name of the engine.
14    #[serde(rename = "name")]
15    pub name: String,
16    /// The description of the engine.
17    #[serde(rename = "description")]
18    pub description: String,
19    /// Condition is a range of 0 to 100 where 0 is completely worn out and 100 is brand new.
20    #[serde(rename = "condition", skip_serializing_if = "Option::is_none")]
21    pub condition: Option<u32>,
22    /// The speed stat of this engine. The higher the speed, the faster a ship can travel from one point to another. Reduces the time of arrival when navigating the ship.
23    #[serde(rename = "speed")]
24    pub speed: u32,
25    #[serde(rename = "requirements")]
26    pub requirements: crate::models::ShipRequirements,
27}
28
29impl ShipEngine {
30    /// Create value with optional fields set to `None`.
31    #[allow(clippy::too_many_arguments)]
32    pub fn new(
33        symbol: Symbol,
34        name: String,
35        description: String,
36        speed: u32,
37        requirements: crate::models::ShipRequirements,
38    ) -> ShipEngine {
39        ShipEngine {
40            symbol,
41            name,
42            description,
43            condition: None,
44            speed,
45            requirements,
46        }
47    }
48}
49
50/// The symbol of the engine.
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
52pub enum Symbol {
53    #[serde(rename = "ENGINE_IMPULSE_DRIVE_I")]
54    ImpulseDriveI,
55    #[serde(rename = "ENGINE_ION_DRIVE_I")]
56    IonDriveI,
57    #[serde(rename = "ENGINE_ION_DRIVE_II")]
58    IonDriveIi,
59    #[serde(rename = "ENGINE_HYPER_DRIVE_I")]
60    HyperDriveI,
61}
62
63impl Default for Symbol {
64    fn default() -> Symbol {
65        Self::ImpulseDriveI
66    }
67}