// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.gainforest.dwc.defs
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

//! Generated bindings for the `app.gainforest.dwc` Lexicon namespace/module.
pub mod event;
pub mod measurement;
pub mod occurrence;


#[allow(unused_imports)]
use alloc::collections::BTreeMap;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
/// The specific nature of the data record. Controlled vocabulary per Darwin Core.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum BasisOfRecordEnum<S: BosStr = DefaultStr> {
    HumanObservation,
    MachineObservation,
    PreservedSpecimen,
    LivingSpecimen,
    FossilSpecimen,
    MaterialSample,
    MaterialEntity,
    MaterialCitation,
    Other(S),
}

impl<S: BosStr> BasisOfRecordEnum<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::HumanObservation => "HumanObservation",
            Self::MachineObservation => "MachineObservation",
            Self::PreservedSpecimen => "PreservedSpecimen",
            Self::LivingSpecimen => "LivingSpecimen",
            Self::FossilSpecimen => "FossilSpecimen",
            Self::MaterialSample => "MaterialSample",
            Self::MaterialEntity => "MaterialEntity",
            Self::MaterialCitation => "MaterialCitation",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "HumanObservation" => Self::HumanObservation,
            "MachineObservation" => Self::MachineObservation,
            "PreservedSpecimen" => Self::PreservedSpecimen,
            "LivingSpecimen" => Self::LivingSpecimen,
            "FossilSpecimen" => Self::FossilSpecimen,
            "MaterialSample" => Self::MaterialSample,
            "MaterialEntity" => Self::MaterialEntity,
            "MaterialCitation" => Self::MaterialCitation,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> AsRef<str> for BasisOfRecordEnum<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<S: BosStr> core::fmt::Display for BasisOfRecordEnum<S> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<S: BosStr> Serialize for BasisOfRecordEnum<S> {
    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
    where
        Ser: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for BasisOfRecordEnum<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for BasisOfRecordEnum<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = BasisOfRecordEnum<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            BasisOfRecordEnum::HumanObservation => BasisOfRecordEnum::HumanObservation,
            BasisOfRecordEnum::MachineObservation => {
                BasisOfRecordEnum::MachineObservation
            }
            BasisOfRecordEnum::PreservedSpecimen => BasisOfRecordEnum::PreservedSpecimen,
            BasisOfRecordEnum::LivingSpecimen => BasisOfRecordEnum::LivingSpecimen,
            BasisOfRecordEnum::FossilSpecimen => BasisOfRecordEnum::FossilSpecimen,
            BasisOfRecordEnum::MaterialSample => BasisOfRecordEnum::MaterialSample,
            BasisOfRecordEnum::MaterialEntity => BasisOfRecordEnum::MaterialEntity,
            BasisOfRecordEnum::MaterialCitation => BasisOfRecordEnum::MaterialCitation,
            BasisOfRecordEnum::Other(v) => BasisOfRecordEnum::Other(v.into_static()),
        }
    }
}

/// Dublin Core type vocabulary for the nature of the resource.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DublinCoreTypeEnum<S: BosStr = DefaultStr> {
    PhysicalObject,
    StillImage,
    MovingImage,
    Sound,
    Text,
    Event,
    Dataset,
    Other(S),
}

impl<S: BosStr> DublinCoreTypeEnum<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::PhysicalObject => "PhysicalObject",
            Self::StillImage => "StillImage",
            Self::MovingImage => "MovingImage",
            Self::Sound => "Sound",
            Self::Text => "Text",
            Self::Event => "Event",
            Self::Dataset => "Dataset",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "PhysicalObject" => Self::PhysicalObject,
            "StillImage" => Self::StillImage,
            "MovingImage" => Self::MovingImage,
            "Sound" => Self::Sound,
            "Text" => Self::Text,
            "Event" => Self::Event,
            "Dataset" => Self::Dataset,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> AsRef<str> for DublinCoreTypeEnum<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<S: BosStr> core::fmt::Display for DublinCoreTypeEnum<S> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<S: BosStr> Serialize for DublinCoreTypeEnum<S> {
    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
    where
        Ser: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for DublinCoreTypeEnum<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for DublinCoreTypeEnum<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = DublinCoreTypeEnum<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            DublinCoreTypeEnum::PhysicalObject => DublinCoreTypeEnum::PhysicalObject,
            DublinCoreTypeEnum::StillImage => DublinCoreTypeEnum::StillImage,
            DublinCoreTypeEnum::MovingImage => DublinCoreTypeEnum::MovingImage,
            DublinCoreTypeEnum::Sound => DublinCoreTypeEnum::Sound,
            DublinCoreTypeEnum::Text => DublinCoreTypeEnum::Text,
            DublinCoreTypeEnum::Event => DublinCoreTypeEnum::Event,
            DublinCoreTypeEnum::Dataset => DublinCoreTypeEnum::Dataset,
            DublinCoreTypeEnum::Other(v) => DublinCoreTypeEnum::Other(v.into_static()),
        }
    }
}

/// A geographic point with uncertainty, following Darwin Core Location class

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Geolocation<S: BosStr = DefaultStr> {
    ///Horizontal distance from the coordinates describing the smallest circle containing the whole location. Zero is not valid.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub coordinate_uncertainty_in_meters: Option<i64>,
    ///Geographic latitude in decimal degrees (WGS84). Positive values north of the Equator, negative south. Range: -90 to 90.
    pub decimal_latitude: S,
    ///Geographic longitude in decimal degrees (WGS84). Positive values east of the Greenwich Meridian, negative west. Range: -180 to 180.
    pub decimal_longitude: S,
    ///The ellipsoid, geodetic datum, or spatial reference system. Recommended: 'EPSG:4326' (WGS84)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub geodetic_datum: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// The nomenclatural code under which the scientific name is constructed.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum NomenclaturalCodeEnum<S: BosStr = DefaultStr> {
    Iczn,
    Icn,
    Icnp,
    Ictv,
    BioCode,
    Other(S),
}

impl<S: BosStr> NomenclaturalCodeEnum<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Iczn => "ICZN",
            Self::Icn => "ICN",
            Self::Icnp => "ICNP",
            Self::Ictv => "ICTV",
            Self::BioCode => "BioCode",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "ICZN" => Self::Iczn,
            "ICN" => Self::Icn,
            "ICNP" => Self::Icnp,
            "ICTV" => Self::Ictv,
            "BioCode" => Self::BioCode,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> AsRef<str> for NomenclaturalCodeEnum<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<S: BosStr> core::fmt::Display for NomenclaturalCodeEnum<S> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<S: BosStr> Serialize for NomenclaturalCodeEnum<S> {
    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
    where
        Ser: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for NomenclaturalCodeEnum<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for NomenclaturalCodeEnum<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = NomenclaturalCodeEnum<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            NomenclaturalCodeEnum::Iczn => NomenclaturalCodeEnum::Iczn,
            NomenclaturalCodeEnum::Icn => NomenclaturalCodeEnum::Icn,
            NomenclaturalCodeEnum::Icnp => NomenclaturalCodeEnum::Icnp,
            NomenclaturalCodeEnum::Ictv => NomenclaturalCodeEnum::Ictv,
            NomenclaturalCodeEnum::BioCode => NomenclaturalCodeEnum::BioCode,
            NomenclaturalCodeEnum::Other(v) => {
                NomenclaturalCodeEnum::Other(v.into_static())
            }
        }
    }
}

/// Statement about the presence or absence of a taxon at a location.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum OccurrenceStatusEnum<S: BosStr = DefaultStr> {
    Present,
    Absent,
    Other(S),
}

impl<S: BosStr> OccurrenceStatusEnum<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Present => "present",
            Self::Absent => "absent",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "present" => Self::Present,
            "absent" => Self::Absent,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> AsRef<str> for OccurrenceStatusEnum<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<S: BosStr> core::fmt::Display for OccurrenceStatusEnum<S> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<S: BosStr> Serialize for OccurrenceStatusEnum<S> {
    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
    where
        Ser: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for OccurrenceStatusEnum<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for OccurrenceStatusEnum<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = OccurrenceStatusEnum<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            OccurrenceStatusEnum::Present => OccurrenceStatusEnum::Present,
            OccurrenceStatusEnum::Absent => OccurrenceStatusEnum::Absent,
            OccurrenceStatusEnum::Other(v) => {
                OccurrenceStatusEnum::Other(v.into_static())
            }
        }
    }
}

/// The sex of the biological individual(s) represented in the occurrence.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SexEnum<S: BosStr = DefaultStr> {
    Male,
    Female,
    Hermaphrodite,
    Other(S),
}

impl<S: BosStr> SexEnum<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Male => "male",
            Self::Female => "female",
            Self::Hermaphrodite => "hermaphrodite",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "male" => Self::Male,
            "female" => Self::Female,
            "hermaphrodite" => Self::Hermaphrodite,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> AsRef<str> for SexEnum<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<S: BosStr> core::fmt::Display for SexEnum<S> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<S: BosStr> Serialize for SexEnum<S> {
    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
    where
        Ser: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for SexEnum<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for SexEnum<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = SexEnum<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            SexEnum::Male => SexEnum::Male,
            SexEnum::Female => SexEnum::Female,
            SexEnum::Hermaphrodite => SexEnum::Hermaphrodite,
            SexEnum::Other(v) => SexEnum::Other(v.into_static()),
        }
    }
}

/// A taxonomic identification with provenance metadata

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct TaxonIdentification<S: BosStr = DefaultStr> {
    ///Date the identification was made (ISO 8601)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub date_identified: Option<S>,
    ///GBIF backbone taxonomy key for the identified taxon
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gbif_taxon_key: Option<S>,
    ///Uncertainty qualifier applied to the taxon name (e.g., 'cf. agrestis', 'aff. agrestis')
    #[serde(skip_serializing_if = "Option::is_none")]
    pub identification_qualifier: Option<S>,
    ///Notes or comments about the identification
    #[serde(skip_serializing_if = "Option::is_none")]
    pub identification_remarks: Option<S>,
    ///Person(s) who made the identification (pipe-delimited for multiple)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub identified_by: Option<S>,
    ///ORCID or other persistent identifier for the person(s) who identified (pipe-delimited)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub identified_by_id: Option<S>,
    ///The full scientific name including authorship and date
    pub scientific_name: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// The taxonomic rank of the most specific name in the scientificName.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TaxonRankEnum<S: BosStr = DefaultStr> {
    Kingdom,
    Phylum,
    Class,
    Order,
    Family,
    Subfamily,
    Genus,
    Subgenus,
    Species,
    Subspecies,
    Variety,
    Form,
    Other(S),
}

impl<S: BosStr> TaxonRankEnum<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Kingdom => "kingdom",
            Self::Phylum => "phylum",
            Self::Class => "class",
            Self::Order => "order",
            Self::Family => "family",
            Self::Subfamily => "subfamily",
            Self::Genus => "genus",
            Self::Subgenus => "subgenus",
            Self::Species => "species",
            Self::Subspecies => "subspecies",
            Self::Variety => "variety",
            Self::Form => "form",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "kingdom" => Self::Kingdom,
            "phylum" => Self::Phylum,
            "class" => Self::Class,
            "order" => Self::Order,
            "family" => Self::Family,
            "subfamily" => Self::Subfamily,
            "genus" => Self::Genus,
            "subgenus" => Self::Subgenus,
            "species" => Self::Species,
            "subspecies" => Self::Subspecies,
            "variety" => Self::Variety,
            "form" => Self::Form,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> AsRef<str> for TaxonRankEnum<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<S: BosStr> core::fmt::Display for TaxonRankEnum<S> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<S: BosStr> Serialize for TaxonRankEnum<S> {
    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
    where
        Ser: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for TaxonRankEnum<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for TaxonRankEnum<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = TaxonRankEnum<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            TaxonRankEnum::Kingdom => TaxonRankEnum::Kingdom,
            TaxonRankEnum::Phylum => TaxonRankEnum::Phylum,
            TaxonRankEnum::Class => TaxonRankEnum::Class,
            TaxonRankEnum::Order => TaxonRankEnum::Order,
            TaxonRankEnum::Family => TaxonRankEnum::Family,
            TaxonRankEnum::Subfamily => TaxonRankEnum::Subfamily,
            TaxonRankEnum::Genus => TaxonRankEnum::Genus,
            TaxonRankEnum::Subgenus => TaxonRankEnum::Subgenus,
            TaxonRankEnum::Species => TaxonRankEnum::Species,
            TaxonRankEnum::Subspecies => TaxonRankEnum::Subspecies,
            TaxonRankEnum::Variety => TaxonRankEnum::Variety,
            TaxonRankEnum::Form => TaxonRankEnum::Form,
            TaxonRankEnum::Other(v) => TaxonRankEnum::Other(v.into_static()),
        }
    }
}

impl<S: BosStr> LexiconSchema for Geolocation<S> {
    fn nsid() -> &'static str {
        "app.gainforest.dwc.defs"
    }
    fn def_name() -> &'static str {
        "geolocation"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_gainforest_dwc_defs()
    }
    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,
                });
            }
        }
        {
            let 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,
                    });
                }
            }
        }
        {
            let 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,
                    });
                }
            }
        }
        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,
                    });
                }
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for TaxonIdentification<S> {
    fn nsid() -> &'static str {
        "app.gainforest.dwc.defs"
    }
    fn def_name() -> &'static str {
        "taxonIdentification"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_gainforest_dwc_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.date_identified {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 64usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("date_identified"),
                        max: 64usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.gbif_taxon_key {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 64usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("gbif_taxon_key"),
                        max: 64usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.identification_qualifier {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 256usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("identification_qualifier"),
                        max: 256usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.identification_remarks {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 2048usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("identification_remarks"),
                        max: 2048usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.identified_by {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 512usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("identified_by"),
                        max: 512usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.identified_by_id {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 512usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("identified_by_id"),
                        max: 512usize,
                        actual: count,
                    });
                }
            }
        }
        {
            let value = &self.scientific_name;
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 512usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("scientific_name"),
                        max: 512usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

fn lexicon_doc_app_gainforest_dwc_defs() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("app.gainforest.dwc.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("basisOfRecordEnum"),
                LexUserType::String(LexString {
                    description: Some(
                        CowStr::new_static(
                            "The specific nature of the data record. Controlled vocabulary per Darwin Core.",
                        ),
                    ),
                    max_graphemes: Some(64usize),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dublinCoreTypeEnum"),
                LexUserType::String(LexString {
                    description: Some(
                        CowStr::new_static(
                            "Dublin Core type vocabulary for the nature of the resource.",
                        ),
                    ),
                    max_graphemes: Some(64usize),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("geolocation"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A geographic point with uncertainty, following Darwin Core Location class",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("decimalLatitude"),
                            SmolStr::new_static("decimalLongitude")
                        ],
                    ),
                    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("decimalLatitude"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Geographic latitude in decimal degrees (WGS84). Positive values north of the Equator, negative south. 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). Positive values east of the Greenwich Meridian, negative west. Range: -180 to 180.",
                                    ),
                                ),
                                max_graphemes: Some(32usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("geodeticDatum"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The ellipsoid, geodetic datum, or spatial reference system. Recommended: 'EPSG:4326' (WGS84)",
                                    ),
                                ),
                                max_graphemes: Some(64usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("nomenclaturalCodeEnum"),
                LexUserType::String(LexString {
                    description: Some(
                        CowStr::new_static(
                            "The nomenclatural code under which the scientific name is constructed.",
                        ),
                    ),
                    max_graphemes: Some(64usize),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("occurrenceStatusEnum"),
                LexUserType::String(LexString {
                    description: Some(
                        CowStr::new_static(
                            "Statement about the presence or absence of a taxon at a location.",
                        ),
                    ),
                    max_graphemes: Some(64usize),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("sexEnum"),
                LexUserType::String(LexString {
                    description: Some(
                        CowStr::new_static(
                            "The sex of the biological individual(s) represented in the occurrence.",
                        ),
                    ),
                    max_graphemes: Some(64usize),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("taxonIdentification"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A taxonomic identification with provenance metadata",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("scientificName")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("dateIdentified"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Date the identification was made (ISO 8601)",
                                    ),
                                ),
                                max_graphemes: Some(64usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("gbifTaxonKey"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "GBIF backbone taxonomy key for the identified taxon",
                                    ),
                                ),
                                max_graphemes: Some(64usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("identificationQualifier"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Uncertainty qualifier applied to the taxon name (e.g., 'cf. agrestis', 'aff. agrestis')",
                                    ),
                                ),
                                max_graphemes: Some(256usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("identificationRemarks"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Notes or comments about the identification",
                                    ),
                                ),
                                max_graphemes: Some(2048usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("identifiedBy"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Person(s) who made the identification (pipe-delimited for multiple)",
                                    ),
                                ),
                                max_graphemes: Some(512usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("identifiedByID"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "ORCID or other persistent identifier for the person(s) who identified (pipe-delimited)",
                                    ),
                                ),
                                max_graphemes: Some(512usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("scientificName"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The full scientific name including authorship and date",
                                    ),
                                ),
                                max_graphemes: Some(512usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("taxonRankEnum"),
                LexUserType::String(LexString {
                    description: Some(
                        CowStr::new_static(
                            "The taxonomic rank of the most specific name in the scientificName.",
                        ),
                    ),
                    max_graphemes: Some(64usize),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}