csdif-core 0.1.3

Core library for modeling, validating, and transforming CSDIF data
Documentation
// SPDX-License-Identifier: MIT
// Copyright (c) 2025 Egon Kastelijn
// file: src/model.rs

use serde::{Deserialize, Serialize};

/// Represents a physical sensor used in a CSDIF document.
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Sensor {
    pub id: String,
    pub sensor_type: String,
    pub unit: String,
    pub location: Location,
}

/// Represents a geographic location.
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Location {
    pub latitude: f64,
    pub longitude: f64,
    pub elevation: Option<f64>,
}

/// Represents a single observation from a sensor.
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Observation {
    pub timestamp: String,
    pub value: f64,
    pub sensor_id: String,
}

/// Represents a full CSDIF document.
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CsdifDocument {
    pub sensors: Vec<Sensor>,
    pub observations: Vec<Observation>,
}

#[derive(Debug)]
pub struct StationProfile {
    pub id: String,
}