1use std::collections::BTreeSet;
2
3use serde::{Deserialize, Serialize};
4
5use crate::{
6 maps::continents::{ContinentId, ContinentRectangle, FloorId, MapRectangle, RegionId},
7 BulkEndpoint, Endpoint, EndpointWithId,
8};
9
10pub mod continents;
11
12pub type MapId = u32;
13
14#[derive(Clone, PartialEq, Eq, PartialOrd, Debug, Serialize, Deserialize)]
15#[cfg_attr(test, serde(deny_unknown_fields))]
16pub enum MapType {
17 BlueHome,
19 Center,
21 EdgeOfTheMists,
23 GreenHome,
25 Instance,
27 JumpPuzzle,
30 Public,
32 Pvp,
34 RedHome,
36 Tutorial,
38 Unknown,
39}
40
41#[derive(Clone, Debug, Serialize, Deserialize)]
42#[cfg_attr(test, serde(deny_unknown_fields))]
43pub struct Map {
44 pub id: MapId,
46 pub name: String,
48 pub min_level: u8,
50 pub max_level: u8,
52 pub default_floor: FloorId,
54 #[serde(rename = "type")]
56 pub _type: MapType,
57 pub floors: BTreeSet<FloorId>,
59 pub region_id: Option<RegionId>,
61 pub region_name: Option<String>,
63 pub continent_id: Option<ContinentId>,
65 pub continent_name: Option<String>,
67 pub map_rect: MapRectangle,
69 pub continent_rect: ContinentRectangle,
71}
72
73impl EndpointWithId for Map {
74 type IdType = MapId;
75}
76impl Endpoint for Map {
77 const AUTHENTICATED: bool = false;
78 const LOCALE: bool = true;
79 const URL: &'static str = "v2/maps";
80 const VERSION: &'static str = "2023-04-02T00:00:00.000Z";
81}
82
83impl BulkEndpoint for Map {
84 const ALL: bool = true;
85
86 fn id(&self) -> &Self::IdType {
87 &self.id
88 }
89}