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

pub mod get_scrobbles_chart;
pub mod get_top_artists;
pub mod get_top_tracks;


#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::Datetime;
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::app_rocksky::charts;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ChartsView<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub scrobbles: Option<Vec<charts::ScrobbleViewBasic<'a>>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ScrobbleViewBasic<'a> {
    ///The number of scrobbles on this date.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub count: Option<i64>,
    ///The date of the scrobble.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub date: Option<Datetime>,
}

impl<'a> LexiconSchema for ChartsView<'a> {
    fn nsid() -> &'static str {
        "app.rocksky.charts.defs"
    }
    fn def_name() -> &'static str {
        "chartsView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_charts_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for ScrobbleViewBasic<'a> {
    fn nsid() -> &'static str {
        "app.rocksky.charts.defs"
    }
    fn def_name() -> &'static str {
        "scrobbleViewBasic"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_app_rocksky_charts_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_app_rocksky_charts_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.charts.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("chartsView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("scrobbles"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "app.rocksky.charts.defs#scrobbleViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("scrobbleViewBasic"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("count"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("date"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("The date of the scrobble."),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}