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

//! Generated bindings for the `fm.teal.alpha.stats` Lexicon namespace/module.
pub mod get_latest;
pub mod get_top_artists;
pub mod get_top_releases;
pub mod get_user_top_artists;
pub mod get_user_top_releases;


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

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

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ArtistView<S: BosStr = DefaultStr> {
    ///MusicBrainz artist ID URI, formatted as mbid:<uuid>
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mbid: Option<UriValue<S>>,
    ///Artist name
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<S>,
    ///Total number of plays for this artist
    #[serde(skip_serializing_if = "Option::is_none")]
    pub play_count: Option<i64>,
    #[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 RecordingView<S: BosStr = DefaultStr> {
    ///MusicBrainz recording ID URI, formatted as mbid:<uuid>
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mbid: Option<UriValue<S>>,
    ///Recording/track name
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<S>,
    ///Total number of plays for this recording
    #[serde(skip_serializing_if = "Option::is_none")]
    pub play_count: Option<i64>,
    #[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 ReleaseView<S: BosStr = DefaultStr> {
    ///MusicBrainz release ID URI, formatted as mbid:<uuid>
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mbid: Option<UriValue<S>>,
    ///Release/album name
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<S>,
    ///Total number of plays for this release
    #[serde(skip_serializing_if = "Option::is_none")]
    pub play_count: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

impl<S: BosStr> LexiconSchema for ArtistView<S> {
    fn nsid() -> &'static str {
        "fm.teal.alpha.stats.defs"
    }
    fn def_name() -> &'static str {
        "artistView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_fm_teal_alpha_stats_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RecordingView<S> {
    fn nsid() -> &'static str {
        "fm.teal.alpha.stats.defs"
    }
    fn def_name() -> &'static str {
        "recordingView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_fm_teal_alpha_stats_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ReleaseView<S> {
    fn nsid() -> &'static str {
        "fm.teal.alpha.stats.defs"
    }
    fn def_name() -> &'static str {
        "releaseView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_fm_teal_alpha_stats_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_fm_teal_alpha_stats_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("fm.teal.alpha.stats.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("artistView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("mbid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "MusicBrainz artist ID URI, formatted as mbid:<uuid>",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Artist name")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("playCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("recordingView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("mbid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "MusicBrainz recording ID URI, formatted as mbid:<uuid>",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Recording/track name"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("playCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("releaseView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("mbid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "MusicBrainz release ID URI, formatted as mbid:<uuid>",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Release/album name")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("playCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}