artifacts/models/
transition_schema.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5#[cfg_attr(feature = "specta", derive(specta::Type))]
6pub struct TransitionSchema {
7    /// ID of the destination map.
8    #[serde(rename = "map_id")]
9    pub map_id: i32,
10    /// Position X of the destination.
11    #[serde(rename = "x")]
12    pub x: i32,
13    /// Position Y of the destination.
14    #[serde(rename = "y")]
15    pub y: i32,
16    /// Layer of the destination.
17    #[serde(rename = "layer")]
18    pub layer: models::MapLayer,
19    /// Conditions for the transition.
20    #[serde(rename = "conditions", skip_serializing_if = "Option::is_none")]
21    pub conditions: Option<Vec<models::ConditionSchema>>,
22}
23
24impl TransitionSchema {
25    pub fn new(map_id: i32, x: i32, y: i32, layer: models::MapLayer) -> TransitionSchema {
26        TransitionSchema {
27            map_id,
28            x,
29            y,
30            layer,
31            conditions: None,
32        }
33    }
34}