// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: net.anisota.beta.game.collection
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[allow(unused_imports)]
use alloc::collections::BTreeMap;

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::collection::RecordError;
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
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::{Serialize, Deserialize};
use crate::net_anisota::beta::game::collection;
/// Beta version: Record representing a collected specimen in a player's collection

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Collection<'a> {
    ///When the specimen was first acquired
    pub acquired_at: Datetime,
    ///Common name of the specimen
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub common_name: Option<CowStr<'a>>,
    ///When the record was created
    pub created_at: Datetime,
    ///Taxonomic family
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub family: Option<CowStr<'a>>,
    ///Taxonomic genus
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub genus: Option<CowStr<'a>>,
    ///When the record was last modified
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_modified: Option<Datetime>,
    ///When the specimen was last encountered
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_seen: Option<Datetime>,
    ///URI of the game.log record that documents the acquisition of this specimen
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub log_record_uri: Option<CowStr<'a>>,
    ///Number of specimens collected
    pub quantity: i64,
    ///Rarity level of the specimen
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub rarity: Option<CowStr<'a>>,
    ///Scientific name of the specimen
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub scientific_name: Option<CowStr<'a>>,
    ///How the specimen was acquired
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub source: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub source_details: Option<collection::SourceDetails<'a>>,
    ///Taxonomic species
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub species: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub specimen_data: Option<collection::SpecimenData<'a>>,
    ///Unique identifier for the specimen
    #[serde(borrow)]
    pub specimen_id: CowStr<'a>,
    ///Collection status of this specimen
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub status: Option<CowStr<'a>>,
}

/// Typed wrapper for GetRecord response with this collection's record type.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct CollectionGetRecordOutput<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub cid: Option<Cid<'a>>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
    #[serde(borrow)]
    pub value: Collection<'a>,
}

/// Additional details about how the specimen was acquired

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct SourceDetails<'a> {
    ///Number of attempts before successful capture
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attempts: Option<i64>,
    ///Probability used when catching this specimen (decimal string, e.g. '0.75')
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub catch_probability: Option<CowStr<'a>>,
    ///URI of the game card that provided this specimen
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub game_card_uri: Option<CowStr<'a>>,
    ///Location where specimen was found or observed
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub location: Option<CowStr<'a>>,
}

/// Complete specimen information

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct SpecimenData<'a> {
    ///Scientific authorship of the species
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub authorship: Option<CowStr<'a>>,
    ///Detailed description of the specimen
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub description: Option<CowStr<'a>>,
}

impl<'a> Collection<'a> {
    pub fn uri(
        uri: impl Into<CowStr<'a>>,
    ) -> Result<RecordUri<'a, CollectionRecord>, UriError> {
        RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
    }
}

/// Marker type for deserializing records from this collection.

#[derive(Debug, Serialize, Deserialize)]
pub struct CollectionRecord;
impl XrpcResp for CollectionRecord {
    const NSID: &'static str = "net.anisota.beta.game.collection";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = CollectionGetRecordOutput<'de>;
    type Err<'de> = RecordError<'de>;
}

impl From<CollectionGetRecordOutput<'_>> for Collection<'_> {
    fn from(output: CollectionGetRecordOutput<'_>) -> Self {
        use jacquard_common::IntoStatic;
        output.value.into_static()
    }
}

impl jacquard_common::types::collection::Collection for Collection<'_> {
    const NSID: &'static str = "net.anisota.beta.game.collection";
    type Record = CollectionRecord;
}

impl jacquard_common::types::collection::Collection for CollectionRecord {
    const NSID: &'static str = "net.anisota.beta.game.collection";
    type Record = CollectionRecord;
}

impl<'a> LexiconSchema for Collection<'a> {
    fn nsid() -> &'static str {
        "net.anisota.beta.game.collection"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_net_anisota_beta_game_collection()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.common_name {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("common_name"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.family {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("family"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.genus {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("genus"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.quantity;
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("quantity"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.scientific_name {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("scientific_name"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.species {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("species"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.specimen_id;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("specimen_id"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for SourceDetails<'a> {
    fn nsid() -> &'static str {
        "net.anisota.beta.game.collection"
    }
    fn def_name() -> &'static str {
        "sourceDetails"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_net_anisota_beta_game_collection()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for SpecimenData<'a> {
    fn nsid() -> &'static str {
        "net.anisota.beta.game.collection"
    }
    fn def_name() -> &'static str {
        "specimenData"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_net_anisota_beta_game_collection()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod collection_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Quantity;
        type SpecimenId;
        type CreatedAt;
        type AcquiredAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Quantity = Unset;
        type SpecimenId = Unset;
        type CreatedAt = Unset;
        type AcquiredAt = Unset;
    }
    ///State transition - sets the `quantity` field to Set
    pub struct SetQuantity<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetQuantity<S> {}
    impl<S: State> State for SetQuantity<S> {
        type Quantity = Set<members::quantity>;
        type SpecimenId = S::SpecimenId;
        type CreatedAt = S::CreatedAt;
        type AcquiredAt = S::AcquiredAt;
    }
    ///State transition - sets the `specimen_id` field to Set
    pub struct SetSpecimenId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSpecimenId<S> {}
    impl<S: State> State for SetSpecimenId<S> {
        type Quantity = S::Quantity;
        type SpecimenId = Set<members::specimen_id>;
        type CreatedAt = S::CreatedAt;
        type AcquiredAt = S::AcquiredAt;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Quantity = S::Quantity;
        type SpecimenId = S::SpecimenId;
        type CreatedAt = Set<members::created_at>;
        type AcquiredAt = S::AcquiredAt;
    }
    ///State transition - sets the `acquired_at` field to Set
    pub struct SetAcquiredAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAcquiredAt<S> {}
    impl<S: State> State for SetAcquiredAt<S> {
        type Quantity = S::Quantity;
        type SpecimenId = S::SpecimenId;
        type CreatedAt = S::CreatedAt;
        type AcquiredAt = Set<members::acquired_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `quantity` field
        pub struct quantity(());
        ///Marker type for the `specimen_id` field
        pub struct specimen_id(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `acquired_at` field
        pub struct acquired_at(());
    }
}

/// Builder for constructing an instance of this type
pub struct CollectionBuilder<'a, S: collection_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<i64>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<collection::SourceDetails<'a>>,
        Option<CowStr<'a>>,
        Option<collection::SpecimenData<'a>>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Collection<'a> {
    /// Create a new builder for this type
    pub fn new() -> CollectionBuilder<'a, collection_state::Empty> {
        CollectionBuilder::new()
    }
}

impl<'a> CollectionBuilder<'a, collection_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        CollectionBuilder {
            _state: PhantomData,
            _fields: (
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
            ),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> CollectionBuilder<'a, S>
where
    S: collection_state::State,
    S::AcquiredAt: collection_state::IsUnset,
{
    /// Set the `acquiredAt` field (required)
    pub fn acquired_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> CollectionBuilder<'a, collection_state::SetAcquiredAt<S>> {
        self._fields.0 = Option::Some(value.into());
        CollectionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `commonName` field (optional)
    pub fn common_name(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `commonName` field to an Option value (optional)
    pub fn maybe_common_name(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S> CollectionBuilder<'a, S>
where
    S: collection_state::State,
    S::CreatedAt: collection_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> CollectionBuilder<'a, collection_state::SetCreatedAt<S>> {
        self._fields.2 = Option::Some(value.into());
        CollectionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `family` field (optional)
    pub fn family(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `family` field to an Option value (optional)
    pub fn maybe_family(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `genus` field (optional)
    pub fn genus(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `genus` field to an Option value (optional)
    pub fn maybe_genus(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `lastModified` field (optional)
    pub fn last_modified(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `lastModified` field to an Option value (optional)
    pub fn maybe_last_modified(mut self, value: Option<Datetime>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `lastSeen` field (optional)
    pub fn last_seen(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `lastSeen` field to an Option value (optional)
    pub fn maybe_last_seen(mut self, value: Option<Datetime>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `logRecordUri` field (optional)
    pub fn log_record_uri(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `logRecordUri` field to an Option value (optional)
    pub fn maybe_log_record_uri(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<'a, S> CollectionBuilder<'a, S>
where
    S: collection_state::State,
    S::Quantity: collection_state::IsUnset,
{
    /// Set the `quantity` field (required)
    pub fn quantity(
        mut self,
        value: impl Into<i64>,
    ) -> CollectionBuilder<'a, collection_state::SetQuantity<S>> {
        self._fields.8 = Option::Some(value.into());
        CollectionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `rarity` field (optional)
    pub fn rarity(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `rarity` field to an Option value (optional)
    pub fn maybe_rarity(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `scientificName` field (optional)
    pub fn scientific_name(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `scientificName` field to an Option value (optional)
    pub fn maybe_scientific_name(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `source` field (optional)
    pub fn source(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `source` field to an Option value (optional)
    pub fn maybe_source(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `sourceDetails` field (optional)
    pub fn source_details(
        mut self,
        value: impl Into<Option<collection::SourceDetails<'a>>>,
    ) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `sourceDetails` field to an Option value (optional)
    pub fn maybe_source_details(
        mut self,
        value: Option<collection::SourceDetails<'a>>,
    ) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `species` field (optional)
    pub fn species(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `species` field to an Option value (optional)
    pub fn maybe_species(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `specimenData` field (optional)
    pub fn specimen_data(
        mut self,
        value: impl Into<Option<collection::SpecimenData<'a>>>,
    ) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `specimenData` field to an Option value (optional)
    pub fn maybe_specimen_data(
        mut self,
        value: Option<collection::SpecimenData<'a>>,
    ) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<'a, S> CollectionBuilder<'a, S>
where
    S: collection_state::State,
    S::SpecimenId: collection_state::IsUnset,
{
    /// Set the `specimenId` field (required)
    pub fn specimen_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> CollectionBuilder<'a, collection_state::SetSpecimenId<S>> {
        self._fields.15 = Option::Some(value.into());
        CollectionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
    /// Set the `status` field (optional)
    pub fn status(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.16 = value.into();
        self
    }
    /// Set the `status` field to an Option value (optional)
    pub fn maybe_status(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.16 = value;
        self
    }
}

impl<'a, S> CollectionBuilder<'a, S>
where
    S: collection_state::State,
    S::Quantity: collection_state::IsSet,
    S::SpecimenId: collection_state::IsSet,
    S::CreatedAt: collection_state::IsSet,
    S::AcquiredAt: collection_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Collection<'a> {
        Collection {
            acquired_at: self._fields.0.unwrap(),
            common_name: self._fields.1,
            created_at: self._fields.2.unwrap(),
            family: self._fields.3,
            genus: self._fields.4,
            last_modified: self._fields.5,
            last_seen: self._fields.6,
            log_record_uri: self._fields.7,
            quantity: self._fields.8.unwrap(),
            rarity: self._fields.9,
            scientific_name: self._fields.10,
            source: self._fields.11,
            source_details: self._fields.12,
            species: self._fields.13,
            specimen_data: self._fields.14,
            specimen_id: self._fields.15.unwrap(),
            status: self._fields.16,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Collection<'a> {
        Collection {
            acquired_at: self._fields.0.unwrap(),
            common_name: self._fields.1,
            created_at: self._fields.2.unwrap(),
            family: self._fields.3,
            genus: self._fields.4,
            last_modified: self._fields.5,
            last_seen: self._fields.6,
            log_record_uri: self._fields.7,
            quantity: self._fields.8.unwrap(),
            rarity: self._fields.9,
            scientific_name: self._fields.10,
            source: self._fields.11,
            source_details: self._fields.12,
            species: self._fields.13,
            specimen_data: self._fields.14,
            specimen_id: self._fields.15.unwrap(),
            status: self._fields.16,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_net_anisota_beta_game_collection() -> 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("net.anisota.beta.game.collection"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(
                        CowStr::new_static(
                            "Beta version: Record representing a collected specimen in a player's collection",
                        ),
                    ),
                    key: Some(CowStr::new_static("tid")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("specimenId"),
                                SmolStr::new_static("quantity"),
                                SmolStr::new_static("acquiredAt"),
                                SmolStr::new_static("createdAt")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("acquiredAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("When the specimen was first acquired"),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("commonName"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Common name of the specimen"),
                                    ),
                                    max_length: Some(200usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("When the record was created"),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("family"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Taxonomic family")),
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("genus"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Taxonomic genus")),
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("lastModified"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("When the record was last modified"),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("lastSeen"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("When the specimen was last encountered"),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("logRecordUri"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "URI of the game.log record that documents the acquisition of this specimen",
                                        ),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("quantity"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("rarity"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Rarity level of the specimen"),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("scientificName"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Scientific name of the specimen"),
                                    ),
                                    max_length: Some(200usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("source"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("How the specimen was acquired"),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("sourceDetails"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#sourceDetails"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("species"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Taxonomic species")),
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("specimenData"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#specimenData"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("specimenId"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Unique identifier for the specimen"),
                                    ),
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("status"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Collection status of this specimen"),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("sourceDetails"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Additional details about how the specimen was acquired",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("attempts"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("catchProbability"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Probability used when catching this specimen (decimal string, e.g. '0.75')",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("gameCardUri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "URI of the game card that provided this specimen",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("location"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Location where specimen was found or observed",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("specimenData"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Complete specimen information"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("authorship"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Scientific authorship of the species"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("description"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Detailed description of the specimen"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}