use serde::{Deserialize, Serialize};
pub type TileUrl = String;
pub type TileJSONUrl = String;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum TileAddressingScheme {
#[serde(rename = "xyz")]
XYZ,
#[serde(rename = "tms")]
TMS,
}
impl Default for TileAddressingScheme {
fn default() -> Self {
TileAddressingScheme::XYZ
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VectorSource {
#[serde(skip_serializing_if = "Option::is_none")]
pub attribution: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bounds: Option<(f64, f64, f64, f64)>,
#[serde(skip_serializing_if = "Option::is_none")]
pub maxzoom: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
pub minzoom: Option<u8>,
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub scheme: Option<TileAddressingScheme>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tiles: Option<TileUrl>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(tag = "type")]
pub enum Source {
#[serde(rename = "vector")]
Vector(VectorSource),
#[serde(rename = "raster")]
Raster(VectorSource), }