#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
rename = "app.gainforest.dwc.event",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Event<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub coordinate_uncertainty_in_meters: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub country_code: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub county: Option<S>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub decimal_latitude: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub decimal_longitude: Option<S>,
pub event_date: S,
pub event_id: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub event_remarks: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub event_time: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub field_notes: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub geodetic_datum: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub habitat: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub locality: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub location_id: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub location_remarks: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub maximum_elevation_in_meters: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_elevation_in_meters: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub municipality: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_event_id: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parent_event_ref: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sample_size_unit: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sample_size_value: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sampling_effort: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sampling_protocol: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub state_province: Option<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct EventGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Event<S>,
}
impl<S: BosStr> Event<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, EventRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct EventRecord;
impl XrpcResp for EventRecord {
const NSID: &'static str = "app.gainforest.dwc.event";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = EventGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<EventGetRecordOutput<S>> for Event<S> {
fn from(output: EventGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Event<S> {
const NSID: &'static str = "app.gainforest.dwc.event";
type Record = EventRecord;
}
impl Collection for EventRecord {
const NSID: &'static str = "app.gainforest.dwc.event";
type Record = EventRecord;
}
impl<S: BosStr> LexiconSchema for Event<S> {
fn nsid() -> &'static str {
"app.gainforest.dwc.event"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_gainforest_dwc_event()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.coordinate_uncertainty_in_meters {
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("coordinate_uncertainty_in_meters"),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.country {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 128usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("country"),
max: 128usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.country_code {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 2usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("country_code"),
max: 2usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.country_code {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) < 2usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("country_code"),
min: 2usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.county {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 256usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("county"),
max: 256usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.decimal_latitude {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 32usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("decimal_latitude"),
max: 32usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.decimal_longitude {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 32usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("decimal_longitude"),
max: 32usize,
actual: count,
});
}
}
}
{
let value = &self.event_date;
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 64usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("event_date"),
max: 64usize,
actual: count,
});
}
}
}
{
let value = &self.event_id;
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 256usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("event_id"),
max: 256usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.event_remarks {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 5000usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("event_remarks"),
max: 5000usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.event_time {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 64usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("event_time"),
max: 64usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.field_notes {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 10000usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("field_notes"),
max: 10000usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.geodetic_datum {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 64usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("geodetic_datum"),
max: 64usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.habitat {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 512usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("habitat"),
max: 512usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.locality {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 1024usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("locality"),
max: 1024usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.location_id {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 256usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("location_id"),
max: 256usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.location_remarks {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 2048usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("location_remarks"),
max: 2048usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.municipality {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 256usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("municipality"),
max: 256usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.parent_event_id {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 256usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("parent_event_id"),
max: 256usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.sample_size_unit {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 128usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("sample_size_unit"),
max: 128usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.sample_size_value {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 64usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("sample_size_value"),
max: 64usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.sampling_effort {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 256usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("sampling_effort"),
max: 256usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.sampling_protocol {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 1024usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("sampling_protocol"),
max: 1024usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.state_province {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 256usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("state_province"),
max: 256usize,
actual: count,
});
}
}
}
Ok(())
}
}
pub mod event_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type EventId;
type EventDate;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type EventId = Unset;
type EventDate = Unset;
type CreatedAt = Unset;
}
pub struct SetEventId<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEventId<St> {}
impl<St: State> State for SetEventId<St> {
type EventId = Set<members::event_id>;
type EventDate = St::EventDate;
type CreatedAt = St::CreatedAt;
}
pub struct SetEventDate<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEventDate<St> {}
impl<St: State> State for SetEventDate<St> {
type EventId = St::EventId;
type EventDate = Set<members::event_date>;
type CreatedAt = St::CreatedAt;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type EventId = St::EventId;
type EventDate = St::EventDate;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct event_id(());
pub struct event_date(());
pub struct created_at(());
}
}
pub struct EventBuilder<S: BosStr, St: event_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<i64>,
Option<S>,
Option<S>,
Option<S>,
Option<Datetime>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<i64>,
Option<i64>,
Option<S>,
Option<S>,
Option<AtUri<S>>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Event<S> {
pub fn new() -> EventBuilder<S, event_state::Empty> {
EventBuilder::new()
}
}
impl<S: BosStr> EventBuilder<S, event_state::Empty> {
pub fn new() -> Self {
EventBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None, None, None, None, None, None, None, None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn coordinate_uncertainty_in_meters(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_coordinate_uncertainty_in_meters(mut self, value: Option<i64>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn country(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_country(mut self, value: Option<S>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn country_code(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_country_code(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn county(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_county(mut self, value: Option<S>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::CreatedAt: event_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> EventBuilder<S, event_state::SetCreatedAt<St>> {
self._fields.4 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn decimal_latitude(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_decimal_latitude(mut self, value: Option<S>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn decimal_longitude(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_decimal_longitude(mut self, value: Option<S>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::EventDate: event_state::IsUnset,
{
pub fn event_date(
mut self,
value: impl Into<S>,
) -> EventBuilder<S, event_state::SetEventDate<St>> {
self._fields.7 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::EventId: event_state::IsUnset,
{
pub fn event_id(mut self, value: impl Into<S>) -> EventBuilder<S, event_state::SetEventId<St>> {
self._fields.8 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn event_remarks(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_event_remarks(mut self, value: Option<S>) -> Self {
self._fields.9 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn event_time(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_event_time(mut self, value: Option<S>) -> Self {
self._fields.10 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn field_notes(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_field_notes(mut self, value: Option<S>) -> Self {
self._fields.11 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn geodetic_datum(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.12 = value.into();
self
}
pub fn maybe_geodetic_datum(mut self, value: Option<S>) -> Self {
self._fields.12 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn habitat(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_habitat(mut self, value: Option<S>) -> Self {
self._fields.13 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn locality(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_locality(mut self, value: Option<S>) -> Self {
self._fields.14 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn location_id(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.15 = value.into();
self
}
pub fn maybe_location_id(mut self, value: Option<S>) -> Self {
self._fields.15 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn location_remarks(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.16 = value.into();
self
}
pub fn maybe_location_remarks(mut self, value: Option<S>) -> Self {
self._fields.16 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn maximum_elevation_in_meters(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.17 = value.into();
self
}
pub fn maybe_maximum_elevation_in_meters(mut self, value: Option<i64>) -> Self {
self._fields.17 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn minimum_elevation_in_meters(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.18 = value.into();
self
}
pub fn maybe_minimum_elevation_in_meters(mut self, value: Option<i64>) -> Self {
self._fields.18 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn municipality(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.19 = value.into();
self
}
pub fn maybe_municipality(mut self, value: Option<S>) -> Self {
self._fields.19 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn parent_event_id(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.20 = value.into();
self
}
pub fn maybe_parent_event_id(mut self, value: Option<S>) -> Self {
self._fields.20 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn parent_event_ref(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.21 = value.into();
self
}
pub fn maybe_parent_event_ref(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.21 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn sample_size_unit(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.22 = value.into();
self
}
pub fn maybe_sample_size_unit(mut self, value: Option<S>) -> Self {
self._fields.22 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn sample_size_value(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.23 = value.into();
self
}
pub fn maybe_sample_size_value(mut self, value: Option<S>) -> Self {
self._fields.23 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn sampling_effort(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.24 = value.into();
self
}
pub fn maybe_sampling_effort(mut self, value: Option<S>) -> Self {
self._fields.24 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn sampling_protocol(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.25 = value.into();
self
}
pub fn maybe_sampling_protocol(mut self, value: Option<S>) -> Self {
self._fields.25 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn state_province(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.26 = value.into();
self
}
pub fn maybe_state_province(mut self, value: Option<S>) -> Self {
self._fields.26 = value;
self
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::EventId: event_state::IsSet,
St::EventDate: event_state::IsSet,
St::CreatedAt: event_state::IsSet,
{
pub fn build(self) -> Event<S> {
Event {
coordinate_uncertainty_in_meters: self._fields.0,
country: self._fields.1,
country_code: self._fields.2,
county: self._fields.3,
created_at: self._fields.4.unwrap(),
decimal_latitude: self._fields.5,
decimal_longitude: self._fields.6,
event_date: self._fields.7.unwrap(),
event_id: self._fields.8.unwrap(),
event_remarks: self._fields.9,
event_time: self._fields.10,
field_notes: self._fields.11,
geodetic_datum: self._fields.12,
habitat: self._fields.13,
locality: self._fields.14,
location_id: self._fields.15,
location_remarks: self._fields.16,
maximum_elevation_in_meters: self._fields.17,
minimum_elevation_in_meters: self._fields.18,
municipality: self._fields.19,
parent_event_id: self._fields.20,
parent_event_ref: self._fields.21,
sample_size_unit: self._fields.22,
sample_size_value: self._fields.23,
sampling_effort: self._fields.24,
sampling_protocol: self._fields.25,
state_province: self._fields.26,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Event<S> {
Event {
coordinate_uncertainty_in_meters: self._fields.0,
country: self._fields.1,
country_code: self._fields.2,
county: self._fields.3,
created_at: self._fields.4.unwrap(),
decimal_latitude: self._fields.5,
decimal_longitude: self._fields.6,
event_date: self._fields.7.unwrap(),
event_id: self._fields.8.unwrap(),
event_remarks: self._fields.9,
event_time: self._fields.10,
field_notes: self._fields.11,
geodetic_datum: self._fields.12,
habitat: self._fields.13,
locality: self._fields.14,
location_id: self._fields.15,
location_remarks: self._fields.16,
maximum_elevation_in_meters: self._fields.17,
minimum_elevation_in_meters: self._fields.18,
municipality: self._fields.19,
parent_event_id: self._fields.20,
parent_event_ref: self._fields.21,
sample_size_unit: self._fields.22,
sample_size_value: self._fields.23,
sampling_effort: self._fields.24,
sampling_protocol: self._fields.25,
state_province: self._fields.26,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_gainforest_dwc_event() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("app.gainforest.dwc.event"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
description: Some(
CowStr::new_static(
"A sampling or collecting event. Multiple dwc.occurrence records can reference the same event via eventRef, sharing location and protocol metadata.",
),
),
key: Some(CowStr::new_static("tid")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("eventID"),
SmolStr::new_static("eventDate"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("coordinateUncertaintyInMeters"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("country"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The name of the country."),
),
max_graphemes: Some(128usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("countryCode"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("ISO 3166-1 alpha-2 country code."),
),
min_length: Some(2usize),
max_length: Some(2usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("county"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Second-level administrative division."),
),
max_graphemes: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Timestamp of record creation in the ATProto PDS.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("decimalLatitude"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Geographic latitude in decimal degrees (WGS84). Range: -90 to 90.",
),
),
max_graphemes: Some(32usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("decimalLongitude"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Geographic longitude in decimal degrees (WGS84). Range: -180 to 180.",
),
),
max_graphemes: Some(32usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("eventDate"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The date or date range during which the event occurred. ISO 8601 format (e.g., '2024-03-15', '2024-03-15/2024-03-17').",
),
),
max_graphemes: Some(64usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("eventID"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"An identifier for the event. Should be globally unique or unique within the dataset.",
),
),
max_graphemes: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("eventRemarks"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Comments or notes about the event."),
),
max_graphemes: Some(5000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("eventTime"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The time or time range during which the event occurred. ISO 8601 format (e.g., '06:30:00', '06:30:00/09:00:00').",
),
),
max_graphemes: Some(64usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("fieldNotes"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Notes or a reference to notes taken in the field about the event.",
),
),
max_graphemes: Some(10000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("geodeticDatum"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The spatial reference system. Recommended: 'EPSG:4326'.",
),
),
max_graphemes: Some(64usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("habitat"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"A category or description of the habitat in which the event occurred (e.g., 'primary tropical rainforest', 'degraded pasture', 'riparian zone').",
),
),
max_graphemes: Some(512usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("locality"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Specific locality description."),
),
max_graphemes: Some(1024usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("locationID"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Identifier for the location where the event occurred.",
),
),
max_graphemes: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("locationRemarks"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Comments about the location."),
),
max_graphemes: Some(2048usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("maximumElevationInMeters"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("minimumElevationInMeters"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("municipality"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Third-level administrative division."),
),
max_graphemes: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("parentEventID"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"An identifier for the broader event that this event is part of (e.g., a survey campaign that contains multiple transects).",
),
),
max_graphemes: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("parentEventRef"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"AT-URI reference to the parent app.gainforest.dwc.event record.",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("sampleSizeUnit"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The unit of measurement for the sampleSizeValue (e.g., 'square meters', 'hectares', 'trap-nights').",
),
),
max_graphemes: Some(128usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("sampleSizeValue"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"A numeric value for a measurement of the size of a sample in the event (e.g., '20', '0.25').",
),
),
max_graphemes: Some(64usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("samplingEffort"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The amount of effort expended during the event (e.g., '3 person-hours', '14 trap-nights', '2 km transect walked').",
),
),
max_graphemes: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("samplingProtocol"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The names of, references to, or descriptions of the methods used during the event (e.g., 'camera trap array', 'line transect distance sampling', 'audio point count 10-min').",
),
),
max_graphemes: Some(1024usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("stateProvince"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("First-level administrative division."),
),
max_graphemes: Some(256usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}
}