Skip to main content

howler_core/
models.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
5pub enum Source {
6    GBIF,
7    Movebank,
8    INaturalist,
9    IUCN,
10}
11
12impl std::fmt::Display for Source {
13    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14        match self {
15            Source::GBIF => write!(f, "GBIF"),
16            Source::Movebank => write!(f, "Movebank"),
17            Source::INaturalist => write!(f, "iNaturalist"),
18            Source::IUCN => write!(f, "IUCN"),
19        }
20    }
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct Sighting {
25    pub id: Option<i64>,
26    pub species: String,
27    pub scientific_name: Option<String>,
28    pub latitude: f64,
29    pub longitude: f64,
30    pub observed_on: DateTime<Utc>,
31    pub source: Source,
32    pub source_id: String,
33    pub details: Option<String>,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct SpeciesStatus {
38    pub id: Option<i64>,
39    pub scientific_name: String,
40    pub common_name: Option<String>,
41    pub red_list_category: Option<String>,
42    pub population_trend: Option<String>,
43    pub threats: Option<String>,
44}