artifacts/models/
map_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 MapSchema {
7    /// Name of the map.
8    #[serde(rename = "name")]
9    pub name: String,
10    /// Skin of the map.
11    #[serde(rename = "skin")]
12    pub skin: String,
13    /// Position X of the map.
14    #[serde(rename = "x")]
15    pub x: i32,
16    /// Position Y of the map.
17    #[serde(rename = "y")]
18    pub y: i32,
19    #[serde(rename = "content", deserialize_with = "Option::deserialize")]
20    pub content: Option<Box<models::MapContentSchema>>,
21}
22
23impl MapSchema {
24    pub fn new(
25        name: String,
26        skin: String,
27        x: i32,
28        y: i32,
29        content: Option<models::MapContentSchema>,
30    ) -> MapSchema {
31        MapSchema {
32            name,
33            skin,
34            x,
35            y,
36            content: content.map(Box::new),
37        }
38    }
39}