#![deny(unsafe_code)]
mod error;
mod models;
mod queries;
mod schema;
mod store;
pub use error::{Error, Result};
pub use models::{StoredDevice, StoredHistoryRecord, StoredReading, SyncState};
pub use queries::{HistoryQuery, ReadingQuery};
pub use store::{HistoryAggregates, HistoryStats, ImportResult, Store};
pub fn default_db_path() -> std::path::PathBuf {
std::env::var_os("ARANET_DATA_DIR")
.map(std::path::PathBuf::from)
.or_else(|| dirs::data_local_dir().map(|d| d.join("aranet")))
.unwrap_or_else(|| {
tracing::warn!(
"Could not determine platform data directory; \
falling back to current directory for database"
);
std::path::PathBuf::from(".")
})
.join("data.db")
}