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

//! Generated bindings for the `app.rocksky.song` Lexicon namespace/module.
pub mod create_song;
pub mod get_song;
pub mod get_songs;
pub mod match_song;


#[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::blob::BlobRef;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
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};
/// A declaration of a song.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "app.rocksky.song",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Song<S: BosStr = DefaultStr> {
    ///The album of the song.
    pub album: S,
    ///The album art of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album_art: Option<BlobRef<S>>,
    ///The album artist of the song.
    pub album_artist: S,
    ///The Apple Music link of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub apple_music_link: Option<UriValue<S>>,
    ///The artist of the song.
    pub artist: S,
    ///The composer of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub composer: Option<S>,
    ///The copyright message of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub copyright_message: Option<S>,
    ///The date when the song was created.
    pub created_at: Datetime,
    ///The disc number of the song in the album.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disc_number: Option<i64>,
    ///The duration of the song in seconds.
    pub duration: i64,
    ///The genre of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub genre: Option<S>,
    ///The label of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub label: Option<S>,
    ///The lyrics of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lyrics: Option<S>,
    ///The MusicBrainz ID of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mbid: Option<S>,
    ///The release date of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub release_date: Option<Datetime>,
    ///The Spotify link of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub spotify_link: Option<UriValue<S>>,
    ///The tags of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<S>>,
    ///The Tidal link of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tidal_link: Option<UriValue<S>>,
    ///The title of the song.
    pub title: S,
    ///The track number of the song in the album.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub track_number: Option<i64>,
    ///Informations about the song
    #[serde(skip_serializing_if = "Option::is_none")]
    pub wiki: Option<S>,
    ///The year the song was released.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub year: Option<i64>,
    ///The YouTube link of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub youtube_link: Option<UriValue<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 SongGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Song<S>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SongViewBasic<S: BosStr = DefaultStr> {
    ///The album of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album: Option<S>,
    ///The URL of the album art image.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album_art: Option<UriValue<S>>,
    ///The artist of the album the song belongs to.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album_artist: Option<S>,
    ///The URI of the album the song belongs to.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album_uri: Option<AtUri<S>>,
    ///The artist of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub artist: Option<S>,
    ///The URI of the artist of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub artist_uri: Option<AtUri<S>>,
    ///The timestamp when the song was created.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<Datetime>,
    ///The disc number of the song in the album.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disc_number: Option<i64>,
    ///The duration of the song in milliseconds.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration: Option<i64>,
    ///The unique identifier of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<S>,
    ///The number of times the song has been played.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub play_count: Option<i64>,
    ///The SHA256 hash of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sha256: Option<S>,
    ///The title of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<S>,
    ///The track number of the song in the album.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub track_number: Option<i64>,
    ///The number of unique listeners who have played the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub unique_listeners: Option<i64>,
    ///The URI of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uri: Option<AtUri<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SongViewDetailed<S: BosStr = DefaultStr> {
    ///The album of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album: Option<S>,
    ///The URL of the album art image.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album_art: Option<UriValue<S>>,
    ///The artist of the album the song belongs to.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album_artist: Option<S>,
    ///The URI of the album the song belongs to.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album_uri: Option<AtUri<S>>,
    ///The artist of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub artist: Option<S>,
    ///The URI of the artist of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub artist_uri: Option<AtUri<S>>,
    ///The timestamp when the song was created.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<Datetime>,
    ///The disc number of the song in the album.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disc_number: Option<i64>,
    ///The duration of the song in milliseconds.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration: Option<i64>,
    ///The unique identifier of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<S>,
    ///The number of times the song has been played.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub play_count: Option<i64>,
    ///The SHA256 hash of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sha256: Option<S>,
    ///The title of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<S>,
    ///The track number of the song in the album.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub track_number: Option<i64>,
    ///The number of unique listeners who have played the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub unique_listeners: Option<i64>,
    ///The URI of the song.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uri: Option<AtUri<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

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

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

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

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

impl<S: BosStr> Collection for Song<S> {
    const NSID: &'static str = "app.rocksky.song";
    type Record = SongRecord;
}

impl Collection for SongRecord {
    const NSID: &'static str = "app.rocksky.song";
    type Record = SongRecord;
}

impl<S: BosStr> LexiconSchema for Song<S> {
    fn nsid() -> &'static str {
        "app.rocksky.song"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_song()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.album;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 256usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("album"),
                    max: 256usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.album;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 1usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("album"),
                    min: 1usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.album_art {
            {
                let size = value.blob().size;
                if size > 2000000usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("album_art"),
                        max: 2000000usize,
                        actual: size,
                    });
                }
            }
        }
        if let Some(ref value) = self.album_art {
            {
                let mime = value.blob().mime_type.as_str();
                let accepted: &[&str] = &["image/png", "image/jpeg"];
                let matched = accepted
                    .iter()
                    .any(|pattern| {
                        if *pattern == "*/*" {
                            true
                        } else if pattern.ends_with("/*") {
                            let prefix = &pattern[..pattern.len() - 2];
                            mime.starts_with(prefix)
                                && mime.as_bytes().get(prefix.len()) == Some(&b'/')
                        } else {
                            mime == *pattern
                        }
                    });
                if !matched {
                    return Err(ConstraintError::BlobMimeTypeNotAccepted {
                        path: ValidationPath::from_field("album_art"),
                        accepted: vec![
                            "image/png".to_string(), "image/jpeg".to_string()
                        ],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        {
            let value = &self.album_artist;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 256usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("album_artist"),
                    max: 256usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.album_artist;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 1usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("album_artist"),
                    min: 1usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.artist;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 256usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("artist"),
                    max: 256usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.artist;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 1usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("artist"),
                    min: 1usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.composer {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 256usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("composer"),
                    max: 256usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.copyright_message {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 256usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("copyright_message"),
                    max: 256usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.disc_number {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("disc_number"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.duration;
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("duration"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.genre {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 256usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("genre"),
                    max: 256usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.genre {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 1usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("genre"),
                    min: 1usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.label {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 256usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("label"),
                    max: 256usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.lyrics {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("lyrics"),
                    max: 10000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.title;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 512usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("title"),
                    max: 512usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.title;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 1usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("title"),
                    min: 1usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.track_number {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("track_number"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.wiki {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("wiki"),
                    max: 10000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for SongViewBasic<S> {
    fn nsid() -> &'static str {
        "app.rocksky.song.defs"
    }
    fn def_name() -> &'static str {
        "songViewBasic"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_song_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.play_count {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("play_count"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.unique_listeners {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("unique_listeners"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for SongViewDetailed<S> {
    fn nsid() -> &'static str {
        "app.rocksky.song.defs"
    }
    fn def_name() -> &'static str {
        "songViewDetailed"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_song_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.play_count {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("play_count"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.unique_listeners {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("unique_listeners"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

pub mod song_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 Album;
        type AlbumArtist;
        type Artist;
        type CreatedAt;
        type Duration;
        type Title;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Album = Unset;
        type AlbumArtist = Unset;
        type Artist = Unset;
        type CreatedAt = Unset;
        type Duration = Unset;
        type Title = Unset;
    }
    ///State transition - sets the `album` field to Set
    pub struct SetAlbum<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAlbum<St> {}
    impl<St: State> State for SetAlbum<St> {
        type Album = Set<members::album>;
        type AlbumArtist = St::AlbumArtist;
        type Artist = St::Artist;
        type CreatedAt = St::CreatedAt;
        type Duration = St::Duration;
        type Title = St::Title;
    }
    ///State transition - sets the `album_artist` field to Set
    pub struct SetAlbumArtist<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAlbumArtist<St> {}
    impl<St: State> State for SetAlbumArtist<St> {
        type Album = St::Album;
        type AlbumArtist = Set<members::album_artist>;
        type Artist = St::Artist;
        type CreatedAt = St::CreatedAt;
        type Duration = St::Duration;
        type Title = St::Title;
    }
    ///State transition - sets the `artist` field to Set
    pub struct SetArtist<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetArtist<St> {}
    impl<St: State> State for SetArtist<St> {
        type Album = St::Album;
        type AlbumArtist = St::AlbumArtist;
        type Artist = Set<members::artist>;
        type CreatedAt = St::CreatedAt;
        type Duration = St::Duration;
        type Title = St::Title;
    }
    ///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 Album = St::Album;
        type AlbumArtist = St::AlbumArtist;
        type Artist = St::Artist;
        type CreatedAt = Set<members::created_at>;
        type Duration = St::Duration;
        type Title = St::Title;
    }
    ///State transition - sets the `duration` field to Set
    pub struct SetDuration<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDuration<St> {}
    impl<St: State> State for SetDuration<St> {
        type Album = St::Album;
        type AlbumArtist = St::AlbumArtist;
        type Artist = St::Artist;
        type CreatedAt = St::CreatedAt;
        type Duration = Set<members::duration>;
        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 Album = St::Album;
        type AlbumArtist = St::AlbumArtist;
        type Artist = St::Artist;
        type CreatedAt = St::CreatedAt;
        type Duration = St::Duration;
        type Title = Set<members::title>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `album` field
        pub struct album(());
        ///Marker type for the `album_artist` field
        pub struct album_artist(());
        ///Marker type for the `artist` field
        pub struct artist(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `duration` field
        pub struct duration(());
        ///Marker type for the `title` field
        pub struct title(());
    }
}

/// Builder for constructing an instance of this type.
pub struct SongBuilder<St: song_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<BlobRef<S>>,
        Option<S>,
        Option<UriValue<S>>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<Datetime>,
        Option<i64>,
        Option<i64>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<S>,
        Option<Datetime>,
        Option<UriValue<S>>,
        Option<Vec<S>>,
        Option<UriValue<S>>,
        Option<S>,
        Option<i64>,
        Option<S>,
        Option<i64>,
        Option<UriValue<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> Song<S> {
    /// Create a new builder for this type
    pub fn builder() -> SongBuilder<song_state::Empty, S> {
        SongBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SongBuilder<St, S>
where
    St: song_state::State,
    St::Album: song_state::IsUnset,
{
    /// Set the `album` field (required)
    pub fn album(
        mut self,
        value: impl Into<S>,
    ) -> SongBuilder<song_state::SetAlbum<St>, S> {
        self._fields.0 = Option::Some(value.into());
        SongBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `albumArt` field (optional)
    pub fn album_art(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `albumArt` field to an Option value (optional)
    pub fn maybe_album_art(mut self, value: Option<BlobRef<S>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> SongBuilder<St, S>
where
    St: song_state::State,
    St::AlbumArtist: song_state::IsUnset,
{
    /// Set the `albumArtist` field (required)
    pub fn album_artist(
        mut self,
        value: impl Into<S>,
    ) -> SongBuilder<song_state::SetAlbumArtist<St>, S> {
        self._fields.2 = Option::Some(value.into());
        SongBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `appleMusicLink` field (optional)
    pub fn apple_music_link(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `appleMusicLink` field to an Option value (optional)
    pub fn maybe_apple_music_link(mut self, value: Option<UriValue<S>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> SongBuilder<St, S>
where
    St: song_state::State,
    St::Artist: song_state::IsUnset,
{
    /// Set the `artist` field (required)
    pub fn artist(
        mut self,
        value: impl Into<S>,
    ) -> SongBuilder<song_state::SetArtist<St>, S> {
        self._fields.4 = Option::Some(value.into());
        SongBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `composer` field (optional)
    pub fn composer(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `composer` field to an Option value (optional)
    pub fn maybe_composer(mut self, value: Option<S>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `copyrightMessage` field (optional)
    pub fn copyright_message(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `copyrightMessage` field to an Option value (optional)
    pub fn maybe_copyright_message(mut self, value: Option<S>) -> Self {
        self._fields.6 = value;
        self
    }
}

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

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `discNumber` field (optional)
    pub fn disc_number(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `discNumber` field to an Option value (optional)
    pub fn maybe_disc_number(mut self, value: Option<i64>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St, S: BosStr> SongBuilder<St, S>
where
    St: song_state::State,
    St::Duration: song_state::IsUnset,
{
    /// Set the `duration` field (required)
    pub fn duration(
        mut self,
        value: impl Into<i64>,
    ) -> SongBuilder<song_state::SetDuration<St>, S> {
        self._fields.9 = Option::Some(value.into());
        SongBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `genre` field (optional)
    pub fn genre(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `genre` field to an Option value (optional)
    pub fn maybe_genre(mut self, value: Option<S>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `label` field (optional)
    pub fn label(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `label` field to an Option value (optional)
    pub fn maybe_label(mut self, value: Option<S>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `lyrics` field (optional)
    pub fn lyrics(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `lyrics` field to an Option value (optional)
    pub fn maybe_lyrics(mut self, value: Option<S>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `mbid` field (optional)
    pub fn mbid(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `mbid` field to an Option value (optional)
    pub fn maybe_mbid(mut self, value: Option<S>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `releaseDate` field (optional)
    pub fn release_date(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `releaseDate` field to an Option value (optional)
    pub fn maybe_release_date(mut self, value: Option<Datetime>) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `spotifyLink` field (optional)
    pub fn spotify_link(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
        self._fields.15 = value.into();
        self
    }
    /// Set the `spotifyLink` field to an Option value (optional)
    pub fn maybe_spotify_link(mut self, value: Option<UriValue<S>>) -> Self {
        self._fields.15 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `tags` field (optional)
    pub fn tags(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
        self._fields.16 = value.into();
        self
    }
    /// Set the `tags` field to an Option value (optional)
    pub fn maybe_tags(mut self, value: Option<Vec<S>>) -> Self {
        self._fields.16 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `tidalLink` field (optional)
    pub fn tidal_link(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
        self._fields.17 = value.into();
        self
    }
    /// Set the `tidalLink` field to an Option value (optional)
    pub fn maybe_tidal_link(mut self, value: Option<UriValue<S>>) -> Self {
        self._fields.17 = value;
        self
    }
}

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

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `trackNumber` field (optional)
    pub fn track_number(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.19 = value.into();
        self
    }
    /// Set the `trackNumber` field to an Option value (optional)
    pub fn maybe_track_number(mut self, value: Option<i64>) -> Self {
        self._fields.19 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `wiki` field (optional)
    pub fn wiki(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.20 = value.into();
        self
    }
    /// Set the `wiki` field to an Option value (optional)
    pub fn maybe_wiki(mut self, value: Option<S>) -> Self {
        self._fields.20 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `year` field (optional)
    pub fn year(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.21 = value.into();
        self
    }
    /// Set the `year` field to an Option value (optional)
    pub fn maybe_year(mut self, value: Option<i64>) -> Self {
        self._fields.21 = value;
        self
    }
}

impl<St: song_state::State, S: BosStr> SongBuilder<St, S> {
    /// Set the `youtubeLink` field (optional)
    pub fn youtube_link(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
        self._fields.22 = value.into();
        self
    }
    /// Set the `youtubeLink` field to an Option value (optional)
    pub fn maybe_youtube_link(mut self, value: Option<UriValue<S>>) -> Self {
        self._fields.22 = value;
        self
    }
}

impl<St, S: BosStr> SongBuilder<St, S>
where
    St: song_state::State,
    St::Album: song_state::IsSet,
    St::AlbumArtist: song_state::IsSet,
    St::Artist: song_state::IsSet,
    St::CreatedAt: song_state::IsSet,
    St::Duration: song_state::IsSet,
    St::Title: song_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Song<S> {
        Song {
            album: self._fields.0.unwrap(),
            album_art: self._fields.1,
            album_artist: self._fields.2.unwrap(),
            apple_music_link: self._fields.3,
            artist: self._fields.4.unwrap(),
            composer: self._fields.5,
            copyright_message: self._fields.6,
            created_at: self._fields.7.unwrap(),
            disc_number: self._fields.8,
            duration: self._fields.9.unwrap(),
            genre: self._fields.10,
            label: self._fields.11,
            lyrics: self._fields.12,
            mbid: self._fields.13,
            release_date: self._fields.14,
            spotify_link: self._fields.15,
            tags: self._fields.16,
            tidal_link: self._fields.17,
            title: self._fields.18.unwrap(),
            track_number: self._fields.19,
            wiki: self._fields.20,
            year: self._fields.21,
            youtube_link: self._fields.22,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Song<S> {
        Song {
            album: self._fields.0.unwrap(),
            album_art: self._fields.1,
            album_artist: self._fields.2.unwrap(),
            apple_music_link: self._fields.3,
            artist: self._fields.4.unwrap(),
            composer: self._fields.5,
            copyright_message: self._fields.6,
            created_at: self._fields.7.unwrap(),
            disc_number: self._fields.8,
            duration: self._fields.9.unwrap(),
            genre: self._fields.10,
            label: self._fields.11,
            lyrics: self._fields.12,
            mbid: self._fields.13,
            release_date: self._fields.14,
            spotify_link: self._fields.15,
            tags: self._fields.16,
            tidal_link: self._fields.17,
            title: self._fields.18.unwrap(),
            track_number: self._fields.19,
            wiki: self._fields.20,
            year: self._fields.21,
            youtube_link: self._fields.22,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_app_rocksky_song() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("app.rocksky.song"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(CowStr::new_static("A declaration of a song.")),
                    key: Some(CowStr::new_static("tid")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("title"), SmolStr::new_static("artist"),
                                SmolStr::new_static("album"),
                                SmolStr::new_static("albumArtist"),
                                SmolStr::new_static("duration"),
                                SmolStr::new_static("createdAt")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("album"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The album of the song."),
                                    ),
                                    min_length: Some(1usize),
                                    max_length: Some(256usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("albumArt"),
                                LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                            );
                            map.insert(
                                SmolStr::new_static("albumArtist"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The album artist of the song."),
                                    ),
                                    min_length: Some(1usize),
                                    max_length: Some(256usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("appleMusicLink"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The Apple Music link of the song."),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("artist"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The artist of the song."),
                                    ),
                                    min_length: Some(1usize),
                                    max_length: Some(256usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("composer"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The composer of the song."),
                                    ),
                                    max_length: Some(256usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("copyrightMessage"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The copyright message of the song."),
                                    ),
                                    max_length: Some(256usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The date when the song was created."),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("discNumber"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("duration"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("genre"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The genre of the song."),
                                    ),
                                    min_length: Some(1usize),
                                    max_length: Some(256usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("label"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The label of the song."),
                                    ),
                                    max_length: Some(256usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("lyrics"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The lyrics of the song."),
                                    ),
                                    max_length: Some(10000usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("mbid"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The MusicBrainz ID of the song."),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("releaseDate"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The release date of the song."),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("spotifyLink"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The Spotify link of the song."),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("tags"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static("The tags of the song."),
                                    ),
                                    items: LexArrayItem::String(LexString {
                                        min_length: Some(1usize),
                                        max_length: Some(256usize),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("tidalLink"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The Tidal link of the song."),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("title"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The title of the song."),
                                    ),
                                    min_length: Some(1usize),
                                    max_length: Some(512usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("trackNumber"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("wiki"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Informations about the song"),
                                    ),
                                    max_length: Some(10000usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("year"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("youtubeLink"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("The YouTube link of the song."),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

fn lexicon_doc_app_rocksky_song_defs() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("app.rocksky.song.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("songViewBasic"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("album"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The album of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("albumArt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The URL of the album art image."),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("albumArtist"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The artist of the album the song belongs to.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("albumUri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The URI of the album the song belongs to.",
                                    ),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("artist"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The artist of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("artistUri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The URI of the artist of the song."),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The timestamp when the song was created.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("discNumber"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("duration"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The unique identifier of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("playCount"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sha256"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The SHA256 hash of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The title of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("trackNumber"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uniqueListeners"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The URI of the song."),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("songViewDetailed"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("album"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The album of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("albumArt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The URL of the album art image."),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("albumArtist"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The artist of the album the song belongs to.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("albumUri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The URI of the album the song belongs to.",
                                    ),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("artist"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The artist of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("artistUri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The URI of the artist of the song."),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The timestamp when the song was created.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("discNumber"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("duration"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The unique identifier of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("playCount"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sha256"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The SHA256 hash of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The title of the song."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("trackNumber"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uniqueListeners"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The URI of the song."),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}