ogcapi-types 0.3.0

Types as defined by various OGC API Standards.
Documentation
use serde::{Deserialize, Serialize};
use serde_json::Value;

use crate::common::Extent;

use super::{ObservedPropertyCollection, Units};

#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ParameterNames {
    #[serde(default)]
    pub r#type: Type,
    /// Unique ID of the parameter, this is the value used for querying the data
    pub id: Option<String>,
    pub description: Option<Value>,
    pub label: Option<String>,
    #[serde(rename = "data-type")]
    pub data_type: Option<DataType>,
    pub unit: Option<Units>,
    pub observed_property: ObservedPropertyCollection,
    pub category_encoding: Option<Value>,
    pub extent: Option<Extent>,
    pub measurement_type: Option<MeasurementType>,
}

#[derive(Serialize, Deserialize, Default, Debug, PartialEq, Eq, Clone)]
pub enum Type {
    #[default]
    Parameter,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
#[serde(rename_all = "lowercase")]
pub enum DataType {
    Integer,
    Float,
    String,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct MeasurementType {
    /// Approach to calculating the data values
    pub method: String,
    /// The time duration that the value was calculated for as an RFC3339
    /// duration value. If the method value is instantaneous this value is
    /// not required.
    pub duration: Option<String>,
}