use super::{
array_uri_reference::AbsoluteUri, Borehole, Channel, DateTime, Device, JsonValue, Location,
LoggingEquipment, Project, RawData, Tag, Uuid,
};
use crate::array_cache::UriResolvable;
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
pub struct LoggingRun {
pub id: Uuid,
pub starting_depth: f64,
pub ending_depth: Option<f64>,
pub shallowest_depth: f64,
pub deepest_depth: f64,
pub started_at: DateTime,
pub ended_at: Option<DateTime>,
pub channels: Vec<Channel>,
pub raw_data: Option<Vec<RawData>>,
pub device: Device,
pub url_slug: Option<String>,
pub logging_equipment: Option<Vec<LoggingEquipment>>,
pub location: Option<Location>,
pub borehole: Option<Borehole>,
pub project: Option<Project>,
pub metadata: Option<JsonValue>,
pub notes: Option<String>,
pub tags: Option<Vec<Tag>>,
}
impl UriResolvable for LoggingRun {
fn set_base_for_relative_uris(&mut self, base_uri: &AbsoluteUri) {
for channel in &mut self.channels {
channel.set_base_for_relative_uris(base_uri);
}
if let Some(raw_data) = self.raw_data.as_mut() {
for channel_raw_data in raw_data {
channel_raw_data.set_base_for_relative_uris(base_uri);
}
}
}
}