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

//! Generated bindings for the `social.grain.gallery` Lexicon namespace/module.
pub mod item;


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

#[allow(unused_imports)]
use core::marker::PhantomData;
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::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::label::Label;
use crate::com_atproto::label::SelfLabels;
use crate::social_grain::actor::ProfileView;
use crate::social_grain::photo::PhotoView;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "social.grain.gallery",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Gallery<S: BosStr = DefaultStr> {
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    ///Self-label values for this post. Effectively content warnings.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<SelfLabels<S>>,
    pub title: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<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 GalleryGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Gallery<S>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GalleryView<S: BosStr = DefaultStr> {
    pub cid: Cid<S>,
    pub creator: ProfileView<S>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub items: Option<Vec<PhotoView<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<Label<S>>>,
    pub record: Data<S>,
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

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

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

#[derive(Debug, Serialize, Deserialize)]
pub struct GalleryRecord;
impl XrpcResp for GalleryRecord {
    const NSID: &'static str = "social.grain.gallery";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = GalleryGetRecordOutput<S>;
    type Err = RecordError;
}

impl<S: BosStr> From<GalleryGetRecordOutput<S>> for Gallery<S> {
    fn from(output: GalleryGetRecordOutput<S>) -> Self {
        output.value
    }
}

impl<S: BosStr> Collection for Gallery<S> {
    const NSID: &'static str = "social.grain.gallery";
    type Record = GalleryRecord;
}

impl Collection for GalleryRecord {
    const NSID: &'static str = "social.grain.gallery";
    type Record = GalleryRecord;
}

impl<S: BosStr> LexiconSchema for Gallery<S> {
    fn nsid() -> &'static str {
        "social.grain.gallery"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_grain_gallery()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.description {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("description"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.title;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("title"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for GalleryView<S> {
    fn nsid() -> &'static str {
        "social.grain.gallery.defs"
    }
    fn def_name() -> &'static str {
        "galleryView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_grain_gallery_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod gallery_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 CreatedAt;
        type Title;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type Title = Unset;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
    impl<St: State> State for SetCreatedAt<St> {
        type CreatedAt = Set<members::created_at>;
        type Title = St::Title;
    }
    ///State transition - sets the `title` field to Set
    pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTitle<St> {}
    impl<St: State> State for SetTitle<St> {
        type CreatedAt = St::CreatedAt;
        type Title = Set<members::title>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `title` field
        pub struct title(());
    }
}

/// Builder for constructing an instance of this type.
pub struct GalleryBuilder<St: gallery_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<Datetime>, Option<S>, Option<SelfLabels<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> Gallery<S> {
    /// Create a new builder for this type
    pub fn builder() -> GalleryBuilder<gallery_state::Empty, S> {
        GalleryBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> GalleryBuilder<St, S>
where
    St: gallery_state::State,
    St::CreatedAt: gallery_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> GalleryBuilder<gallery_state::SetCreatedAt<St>, S> {
        self._fields.0 = Option::Some(value.into());
        GalleryBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: gallery_state::State, S: BosStr> GalleryBuilder<St, S> {
    /// Set the `description` field (optional)
    pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `description` field to an Option value (optional)
    pub fn maybe_description(mut self, value: Option<S>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: gallery_state::State, S: BosStr> GalleryBuilder<St, S> {
    /// Set the `labels` field (optional)
    pub fn labels(mut self, value: impl Into<Option<SelfLabels<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `labels` field to an Option value (optional)
    pub fn maybe_labels(mut self, value: Option<SelfLabels<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> GalleryBuilder<St, S>
where
    St: gallery_state::State,
    St::Title: gallery_state::IsUnset,
{
    /// Set the `title` field (required)
    pub fn title(
        mut self,
        value: impl Into<S>,
    ) -> GalleryBuilder<gallery_state::SetTitle<St>, S> {
        self._fields.3 = Option::Some(value.into());
        GalleryBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GalleryBuilder<St, S>
where
    St: gallery_state::State,
    St::CreatedAt: gallery_state::IsSet,
    St::Title: gallery_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Gallery<S> {
        Gallery {
            created_at: self._fields.0.unwrap(),
            description: self._fields.1,
            labels: self._fields.2,
            title: self._fields.3.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>>) -> Gallery<S> {
        Gallery {
            created_at: self._fields.0.unwrap(),
            description: self._fields.1,
            labels: self._fields.2,
            title: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_social_grain_gallery() -> 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("social.grain.gallery"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    key: Some(CowStr::new_static("tid")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("title"),
                                SmolStr::new_static("createdAt")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("description"),
                                LexObjectProperty::String(LexString {
                                    max_length: Some(1000usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("labels"),
                                LexObjectProperty::Union(LexRefUnion {
                                    description: Some(
                                        CowStr::new_static(
                                            "Self-label values for this post. Effectively content warnings.",
                                        ),
                                    ),
                                    refs: vec![
                                        CowStr::new_static("com.atproto.label.defs#selfLabels")
                                    ],
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("title"),
                                LexObjectProperty::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod gallery_view_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 Cid;
        type Creator;
        type IndexedAt;
        type Record;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Cid = Unset;
        type Creator = Unset;
        type IndexedAt = Unset;
        type Record = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Cid = Set<members::cid>;
        type Creator = St::Creator;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `creator` field to Set
    pub struct SetCreator<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreator<St> {}
    impl<St: State> State for SetCreator<St> {
        type Cid = St::Cid;
        type Creator = Set<members::creator>;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type Cid = St::Cid;
        type Creator = St::Creator;
        type IndexedAt = Set<members::indexed_at>;
        type Record = St::Record;
        type Uri = St::Uri;
    }
    ///State transition - sets the `record` field to Set
    pub struct SetRecord<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRecord<St> {}
    impl<St: State> State for SetRecord<St> {
        type Cid = St::Cid;
        type Creator = St::Creator;
        type IndexedAt = St::IndexedAt;
        type Record = Set<members::record>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Cid = St::Cid;
        type Creator = St::Creator;
        type IndexedAt = St::IndexedAt;
        type Record = St::Record;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `creator` field
        pub struct creator(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `record` field
        pub struct record(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

/// Builder for constructing an instance of this type.
pub struct GalleryViewBuilder<St: gallery_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Cid<S>>,
        Option<ProfileView<S>>,
        Option<Datetime>,
        Option<Vec<PhotoView<S>>>,
        Option<Vec<Label<S>>>,
        Option<Data<S>>,
        Option<AtUri<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> GalleryView<S> {
    /// Create a new builder for this type
    pub fn builder() -> GalleryViewBuilder<gallery_view_state::Empty, S> {
        GalleryViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> GalleryViewBuilder<St, S>
where
    St: gallery_view_state::State,
    St::Cid: gallery_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> GalleryViewBuilder<gallery_view_state::SetCid<St>, S> {
        self._fields.0 = Option::Some(value.into());
        GalleryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GalleryViewBuilder<St, S>
where
    St: gallery_view_state::State,
    St::Creator: gallery_view_state::IsUnset,
{
    /// Set the `creator` field (required)
    pub fn creator(
        mut self,
        value: impl Into<ProfileView<S>>,
    ) -> GalleryViewBuilder<gallery_view_state::SetCreator<St>, S> {
        self._fields.1 = Option::Some(value.into());
        GalleryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GalleryViewBuilder<St, S>
where
    St: gallery_view_state::State,
    St::IndexedAt: gallery_view_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> GalleryViewBuilder<gallery_view_state::SetIndexedAt<St>, S> {
        self._fields.2 = Option::Some(value.into());
        GalleryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: gallery_view_state::State, S: BosStr> GalleryViewBuilder<St, S> {
    /// Set the `items` field (optional)
    pub fn items(mut self, value: impl Into<Option<Vec<PhotoView<S>>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `items` field to an Option value (optional)
    pub fn maybe_items(mut self, value: Option<Vec<PhotoView<S>>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St: gallery_view_state::State, S: BosStr> GalleryViewBuilder<St, S> {
    /// Set the `labels` field (optional)
    pub fn labels(mut self, value: impl Into<Option<Vec<Label<S>>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `labels` field to an Option value (optional)
    pub fn maybe_labels(mut self, value: Option<Vec<Label<S>>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St, S: BosStr> GalleryViewBuilder<St, S>
where
    St: gallery_view_state::State,
    St::Record: gallery_view_state::IsUnset,
{
    /// Set the `record` field (required)
    pub fn record(
        mut self,
        value: impl Into<Data<S>>,
    ) -> GalleryViewBuilder<gallery_view_state::SetRecord<St>, S> {
        self._fields.5 = Option::Some(value.into());
        GalleryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GalleryViewBuilder<St, S>
where
    St: gallery_view_state::State,
    St::Uri: gallery_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> GalleryViewBuilder<gallery_view_state::SetUri<St>, S> {
        self._fields.6 = Option::Some(value.into());
        GalleryViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GalleryViewBuilder<St, S>
where
    St: gallery_view_state::State,
    St::Cid: gallery_view_state::IsSet,
    St::Creator: gallery_view_state::IsSet,
    St::IndexedAt: gallery_view_state::IsSet,
    St::Record: gallery_view_state::IsSet,
    St::Uri: gallery_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> GalleryView<S> {
        GalleryView {
            cid: self._fields.0.unwrap(),
            creator: self._fields.1.unwrap(),
            indexed_at: self._fields.2.unwrap(),
            items: self._fields.3,
            labels: self._fields.4,
            record: self._fields.5.unwrap(),
            uri: 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>>,
    ) -> GalleryView<S> {
        GalleryView {
            cid: self._fields.0.unwrap(),
            creator: self._fields.1.unwrap(),
            indexed_at: self._fields.2.unwrap(),
            items: self._fields.3,
            labels: self._fields.4,
            record: self._fields.5.unwrap(),
            uri: self._fields.6.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_social_grain_gallery_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("social.grain.gallery.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("galleryView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("creator"),
                            SmolStr::new_static("record"),
                            SmolStr::new_static("indexedAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("creator"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "social.grain.actor.defs#profileView",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("items"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Union(LexRefUnion {
                                    refs: vec![
                                        CowStr::new_static("social.grain.photo.defs#photoView")
                                    ],
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("labels"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("com.atproto.label.defs#label"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}