use serde::{Deserialize, Serialize};
pub const CORE_URI: &str = "https://api.stacspec.org/v1.0.0/core";
pub const FEATURES_URI: &str = "https://api.stacspec.org/v1.0.0/ogcapi-features";
pub const COLLECTIONS_URI: &str = "https://api.stacspec.org/v1.0.0/collections";
pub const OGC_API_FEATURES_URI: &str =
"http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core";
pub const GEOJSON_URI: &str = "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson";
pub const ITEM_SEARCH_URI: &str = "https://api.stacspec.org/v1.0.0/item-search";
#[derive(Debug, Serialize, Deserialize)]
pub struct Conformance {
#[serde(rename = "conformsTo")]
pub conforms_to: Vec<String>,
}
impl Conformance {
pub fn new() -> Conformance {
Conformance {
conforms_to: vec![CORE_URI.to_string()],
}
}
pub fn ogcapi_features(mut self) -> Conformance {
self.conforms_to.push(FEATURES_URI.to_string());
self.conforms_to.push(COLLECTIONS_URI.to_string());
self.conforms_to.push(OGC_API_FEATURES_URI.to_string());
self.conforms_to.push(GEOJSON_URI.to_string());
self
}
pub fn item_search(mut self) -> Conformance {
self.conforms_to.push(ITEM_SEARCH_URI.to_string());
self
}
}
impl Default for Conformance {
fn default() -> Self {
Self::new()
}
}