// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: org.passingreads.book.event
//
// 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, BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::bytes::Bytes;

#[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::{Did, 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, open_union};
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::com_atproto::repo::strong_ref::StrongRef;
use crate::community_lexicon::location::hthree::Hthree;
use crate::org_passingreads::book::event;
/// The status of a book has changed.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "org.passingreads.book.event",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Event<S: BosStr = DefaultStr> {
    ///The book that was dropped (a org.passingreads.book.registration)
    pub book: StrongRef<S>,
    ///The multicodec public key of the book.
    #[serde(with = "jacquard_common::serde_bytes_helper")]
    pub book_pub: Bytes,
    ///The signature of this record, without this attribute, as created by the private key associated with the book
    #[serde(with = "jacquard_common::serde_bytes_helper")]
    pub book_sig: Bytes,
    ///The DID of the person who registered the book. Included here, so it's verifiable with the bookSig.
    pub did: Did<S>,
    ///What event has occurred
    #[serde(skip_serializing_if = "Option::is_none")]
    pub event: Option<EventEvent<S>>,
    ///Where this event occurred (an h3 cell, an OSM place, or a link to an outpost — org.passingreads.outpost.registration)
    pub location: EventLocation<S>,
    ///Client-declared timestamp of when the book was dropped
    pub occurred_at: Datetime,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// What event has occurred

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EventEvent<S: BosStr = DefaultStr> {
    OrgPassingreadsBookCheckin,
    OrgPassingreadsBookDrop,
    OrgPassingreadsBookFind,
    Other(S),
}

impl<S: BosStr> EventEvent<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::OrgPassingreadsBookCheckin => "org.passingreads.book.checkin",
            Self::OrgPassingreadsBookDrop => "org.passingreads.book.drop",
            Self::OrgPassingreadsBookFind => "org.passingreads.book.find",
            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() {
            "org.passingreads.book.checkin" => Self::OrgPassingreadsBookCheckin,
            "org.passingreads.book.drop" => Self::OrgPassingreadsBookDrop,
            "org.passingreads.book.find" => Self::OrgPassingreadsBookFind,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for EventEvent<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 EventEvent<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 + Default> Default for EventEvent<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum EventLocation<S: BosStr = DefaultStr> {
    #[serde(rename = "com.atproto.repo.strongRef#main")]
    StrongRef(Box<StrongRef<S>>),
    #[serde(rename = "community.lexicon.location.hthree#main")]
    Hthree(Box<Hthree<S>>),
    #[serde(rename = "org.passingreads.book.event#osmLocation")]
    OsmLocation(Box<event::OsmLocation<S>>),
}

/// 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 EventGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Event<S>,
}

/// A physical location from OpenStreetMap.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct OsmLocation<S: BosStr = DefaultStr> {
    ///The type of place (e.g., cafe, library, park).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub category: Option<S>,
    ///The name of the place from OpenStreetMap.
    pub name: S,
    ///The OpenStreetMap element ID in interoperable format: N (node), W (way), or R (relation) prefix followed by numeric ID. Example: N123456789
    pub osm_id: S,
    ///The H3 cell index for proximity queries.
    pub value: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

impl<S: BosStr> Event<S> {
    pub fn uri(uri: S) -> Result<RecordUri<S, EventRecord>, UriError> {
        RecordUri::try_from_uri(AtUri::new(uri)?)
    }
}

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

#[derive(Debug, Serialize, Deserialize)]
pub struct EventRecord;
impl XrpcResp for EventRecord {
    const NSID: &'static str = "org.passingreads.book.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 = "org.passingreads.book.event";
    type Record = EventRecord;
}

impl Collection for EventRecord {
    const NSID: &'static str = "org.passingreads.book.event";
    type Record = EventRecord;
}

impl<S: BosStr> LexiconSchema for Event<S> {
    fn nsid() -> &'static str {
        "org.passingreads.book.event"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_org_passingreads_book_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for OsmLocation<S> {
    fn nsid() -> &'static str {
        "org.passingreads.book.event"
    }
    fn def_name() -> &'static str {
        "osmLocation"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_org_passingreads_book_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod event_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 Book;
        type BookPub;
        type BookSig;
        type Did;
        type Location;
        type OccurredAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Book = Unset;
        type BookPub = Unset;
        type BookSig = Unset;
        type Did = Unset;
        type Location = Unset;
        type OccurredAt = Unset;
    }
    ///State transition - sets the `book` field to Set
    pub struct SetBook<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBook<St> {}
    impl<St: State> State for SetBook<St> {
        type Book = Set<members::book>;
        type BookPub = St::BookPub;
        type BookSig = St::BookSig;
        type Did = St::Did;
        type Location = St::Location;
        type OccurredAt = St::OccurredAt;
    }
    ///State transition - sets the `book_pub` field to Set
    pub struct SetBookPub<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBookPub<St> {}
    impl<St: State> State for SetBookPub<St> {
        type Book = St::Book;
        type BookPub = Set<members::book_pub>;
        type BookSig = St::BookSig;
        type Did = St::Did;
        type Location = St::Location;
        type OccurredAt = St::OccurredAt;
    }
    ///State transition - sets the `book_sig` field to Set
    pub struct SetBookSig<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBookSig<St> {}
    impl<St: State> State for SetBookSig<St> {
        type Book = St::Book;
        type BookPub = St::BookPub;
        type BookSig = Set<members::book_sig>;
        type Did = St::Did;
        type Location = St::Location;
        type OccurredAt = St::OccurredAt;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDid<St> {}
    impl<St: State> State for SetDid<St> {
        type Book = St::Book;
        type BookPub = St::BookPub;
        type BookSig = St::BookSig;
        type Did = Set<members::did>;
        type Location = St::Location;
        type OccurredAt = St::OccurredAt;
    }
    ///State transition - sets the `location` field to Set
    pub struct SetLocation<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLocation<St> {}
    impl<St: State> State for SetLocation<St> {
        type Book = St::Book;
        type BookPub = St::BookPub;
        type BookSig = St::BookSig;
        type Did = St::Did;
        type Location = Set<members::location>;
        type OccurredAt = St::OccurredAt;
    }
    ///State transition - sets the `occurred_at` field to Set
    pub struct SetOccurredAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetOccurredAt<St> {}
    impl<St: State> State for SetOccurredAt<St> {
        type Book = St::Book;
        type BookPub = St::BookPub;
        type BookSig = St::BookSig;
        type Did = St::Did;
        type Location = St::Location;
        type OccurredAt = Set<members::occurred_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `book` field
        pub struct book(());
        ///Marker type for the `book_pub` field
        pub struct book_pub(());
        ///Marker type for the `book_sig` field
        pub struct book_sig(());
        ///Marker type for the `did` field
        pub struct did(());
        ///Marker type for the `location` field
        pub struct location(());
        ///Marker type for the `occurred_at` field
        pub struct occurred_at(());
    }
}

/// Builder for constructing an instance of this type.
pub struct EventBuilder<St: event_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<StrongRef<S>>,
        Option<Bytes>,
        Option<Bytes>,
        Option<Did<S>>,
        Option<EventEvent<S>>,
        Option<EventLocation<S>>,
        Option<Datetime>,
    ),
    _type: PhantomData<fn() -> S>,
}

impl Event<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> EventBuilder<event_state::Empty, DefaultStr> {
        EventBuilder::new()
    }
}

impl<S: BosStr> Event<S> {
    /// Create a new builder for this type
    pub fn builder() -> EventBuilder<event_state::Empty, S> {
        EventBuilder::builder()
    }
}

impl EventBuilder<event_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        EventBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> EventBuilder<event_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        EventBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> EventBuilder<St, S>
where
    St: event_state::State,
    St::Book: event_state::IsUnset,
{
    /// Set the `book` field (required)
    pub fn book(
        mut self,
        value: impl Into<StrongRef<S>>,
    ) -> EventBuilder<event_state::SetBook<St>, S> {
        self._fields.0 = Option::Some(value.into());
        EventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> EventBuilder<St, S>
where
    St: event_state::State,
    St::BookPub: event_state::IsUnset,
{
    /// Set the `bookPub` field (required)
    pub fn book_pub(
        mut self,
        value: impl Into<Bytes>,
    ) -> EventBuilder<event_state::SetBookPub<St>, S> {
        self._fields.1 = Option::Some(value.into());
        EventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> EventBuilder<St, S>
where
    St: event_state::State,
    St::BookSig: event_state::IsUnset,
{
    /// Set the `bookSig` field (required)
    pub fn book_sig(
        mut self,
        value: impl Into<Bytes>,
    ) -> EventBuilder<event_state::SetBookSig<St>, S> {
        self._fields.2 = Option::Some(value.into());
        EventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> EventBuilder<St, S>
where
    St: event_state::State,
    St::Did: event_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<Did<S>>,
    ) -> EventBuilder<event_state::SetDid<St>, S> {
        self._fields.3 = Option::Some(value.into());
        EventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: event_state::State, S: BosStr> EventBuilder<St, S> {
    /// Set the `event` field (optional)
    pub fn event(mut self, value: impl Into<Option<EventEvent<S>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `event` field to an Option value (optional)
    pub fn maybe_event(mut self, value: Option<EventEvent<S>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St, S: BosStr> EventBuilder<St, S>
where
    St: event_state::State,
    St::Location: event_state::IsUnset,
{
    /// Set the `location` field (required)
    pub fn location(
        mut self,
        value: impl Into<EventLocation<S>>,
    ) -> EventBuilder<event_state::SetLocation<St>, S> {
        self._fields.5 = Option::Some(value.into());
        EventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> EventBuilder<St, S>
where
    St: event_state::State,
    St::OccurredAt: event_state::IsUnset,
{
    /// Set the `occurredAt` field (required)
    pub fn occurred_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> EventBuilder<event_state::SetOccurredAt<St>, S> {
        self._fields.6 = Option::Some(value.into());
        EventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> EventBuilder<St, S>
where
    St: event_state::State,
    St::Book: event_state::IsSet,
    St::BookPub: event_state::IsSet,
    St::BookSig: event_state::IsSet,
    St::Did: event_state::IsSet,
    St::Location: event_state::IsSet,
    St::OccurredAt: event_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Event<S> {
        Event {
            book: self._fields.0.unwrap(),
            book_pub: self._fields.1.unwrap(),
            book_sig: self._fields.2.unwrap(),
            did: self._fields.3.unwrap(),
            event: self._fields.4,
            location: self._fields.5.unwrap(),
            occurred_at: self._fields.6.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Event<S> {
        Event {
            book: self._fields.0.unwrap(),
            book_pub: self._fields.1.unwrap(),
            book_sig: self._fields.2.unwrap(),
            did: self._fields.3.unwrap(),
            event: self._fields.4,
            location: self._fields.5.unwrap(),
            occurred_at: self._fields.6.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_org_passingreads_book_event() -> 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("org.passingreads.book.event"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(
                        CowStr::new_static("The status of a book has changed."),
                    ),
                    key: Some(CowStr::new_static("tid")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("did"), SmolStr::new_static("book"),
                                SmolStr::new_static("occurredAt"),
                                SmolStr::new_static("location"),
                                SmolStr::new_static("bookPub"),
                                SmolStr::new_static("bookSig")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("book"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "com.atproto.repo.strongRef#main",
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("bookPub"),
                                LexObjectProperty::Bytes(LexBytes { ..Default::default() }),
                            );
                            map.insert(
                                SmolStr::new_static("bookSig"),
                                LexObjectProperty::Bytes(LexBytes { ..Default::default() }),
                            );
                            map.insert(
                                SmolStr::new_static("did"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "The DID of the person who registered the book. Included here, so it's verifiable with the bookSig.",
                                        ),
                                    ),
                                    format: Some(LexStringFormat::Did),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("event"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("What event has occurred"),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("location"),
                                LexObjectProperty::Union(LexRefUnion {
                                    description: Some(
                                        CowStr::new_static(
                                            "Where this event occurred (an h3 cell, an OSM place, or a link to an outpost — org.passingreads.outpost.registration)",
                                        ),
                                    ),
                                    refs: vec![
                                        CowStr::new_static("com.atproto.repo.strongRef#main"),
                                        CowStr::new_static("community.lexicon.location.hthree#main"),
                                        CowStr::new_static("#osmLocation")
                                    ],
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("occurredAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Client-declared timestamp of when the book was dropped",
                                        ),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("osmLocation"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A physical location from OpenStreetMap."),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("osmId"), SmolStr::new_static("name"),
                            SmolStr::new_static("value")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("category"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The type of place (e.g., cafe, library, park).",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The name of the place from OpenStreetMap.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("osmId"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The OpenStreetMap element ID in interoperable format: N (node), W (way), or R (relation) prefix followed by numeric ID. Example: N123456789",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("value"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The H3 cell index for proximity queries.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}