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

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

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::UriValue;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
use crate::app_rocksky::song::SongViewDetailed;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CreateSong<S: BosStr = DefaultStr> {
    ///The album of the song, if applicable
    pub album: S,
    ///The URL of the album art for the song
    #[serde(skip_serializing_if = "Option::is_none")]
    pub album_art: Option<UriValue<S>>,
    ///The album artist of the song, if different from the main artist
    pub album_artist: S,
    ///The artist of the song
    pub artist: S,
    ///The disc number of the song in the album, if applicable
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disc_number: Option<i64>,
    ///The duration of the song in seconds
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration: Option<i64>,
    ///The lyrics of the song, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lyrics: Option<S>,
    ///The MusicBrainz ID of the song, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mb_id: Option<S>,
    ///The release date of the song, formatted as YYYY-MM-DD
    #[serde(skip_serializing_if = "Option::is_none")]
    pub release_date: Option<S>,
    ///The title of the song
    pub title: S,
    ///The track number of the song in the album, if applicable
    #[serde(skip_serializing_if = "Option::is_none")]
    pub track_number: Option<i64>,
    ///The year the song was released
    #[serde(skip_serializing_if = "Option::is_none")]
    pub year: 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)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CreateSongOutput<S: BosStr = DefaultStr> {
    #[serde(flatten)]
    pub value: SongViewDetailed<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/** Response marker for the `app.rocksky.song.createSong` procedure.

Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `CreateSongOutput<S>` for this endpoint.*/
pub struct CreateSongResponse;
impl jacquard_common::xrpc::XrpcResp for CreateSongResponse {
    const NSID: &'static str = "app.rocksky.song.createSong";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = CreateSongOutput<S>;
    type Err = jacquard_common::xrpc::GenericError;
}

impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for CreateSong<S> {
    const NSID: &'static str = "app.rocksky.song.createSong";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Response = CreateSongResponse;
}

/** Endpoint marker for the `app.rocksky.song.createSong` procedure.

Path: `/xrpc/app.rocksky.song.createSong`. The request payload type is `CreateSong<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
pub struct CreateSongRequest;
impl jacquard_common::xrpc::XrpcEndpoint for CreateSongRequest {
    const PATH: &'static str = "/xrpc/app.rocksky.song.createSong";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Request<S: BosStr> = CreateSong<S>;
    type Response = CreateSongResponse;
}