space_traders/models/
waypoint.rs

1//! Generated by: <https://openapi-generator.tech>
2//!
3//! Version of specification: `2.0.0`
4
5use serde::{Deserialize, Serialize};
6
7/// A waypoint is a location that ships can travel to such as a Planet, Moon or Space Station.
8#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9pub struct Waypoint {
10    /// Symbol fo the waypoint.
11    #[serde(rename = "symbol")]
12    pub symbol: String,
13    #[serde(rename = "type")]
14    pub r#type: crate::models::WaypointType,
15    /// The symbol of the system this waypoint belongs to.
16    #[serde(rename = "systemSymbol")]
17    pub system_symbol: String,
18    /// Position in the universe in the x axis.
19    #[serde(rename = "x")]
20    pub x: i32,
21    /// Position in the universe in the Y axis.
22    #[serde(rename = "y")]
23    pub y: i32,
24    /// Waypoints that orbit this waypoint.
25    #[serde(rename = "orbitals")]
26    pub orbitals: Vec<crate::models::WaypointOrbital>,
27    #[serde(rename = "faction", skip_serializing_if = "Option::is_none")]
28    pub faction: Option<crate::models::WaypointFaction>,
29    /// The traits of the waypoint.
30    #[serde(rename = "traits")]
31    pub traits: Vec<crate::models::WaypointTrait>,
32    #[serde(rename = "chart", skip_serializing_if = "Option::is_none")]
33    pub chart: Option<crate::models::Chart>,
34}
35
36impl Waypoint {
37    /// Create value with optional fields set to `None`.
38    #[allow(clippy::too_many_arguments)]
39    pub fn new(
40        symbol: String,
41        r#type: crate::models::WaypointType,
42        system_symbol: String,
43        x: i32,
44        y: i32,
45        orbitals: Vec<crate::models::WaypointOrbital>,
46        traits: Vec<crate::models::WaypointTrait>,
47    ) -> Waypoint {
48        Waypoint {
49            symbol,
50            r#type,
51            system_symbol,
52            x,
53            y,
54            orbitals,
55            faction: None,
56            traits,
57            chart: None,
58        }
59    }
60}