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

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::types::ident::AtIdentifier;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
use crate::app_rocksky::player::CurrentlyPlayingViewDetailed;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetCurrentlyPlaying<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub actor: Option<AtIdentifier<'a>>,
}


#[jacquard_derive::lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetCurrentlyPlayingOutput<'a> {
    #[serde(flatten)]
    #[serde(borrow)]
    pub value: CurrentlyPlayingViewDetailed<'a>,
}

/// Response type for app.rocksky.spotify.getCurrentlyPlaying
pub struct GetCurrentlyPlayingResponse;
impl jacquard_common::xrpc::XrpcResp for GetCurrentlyPlayingResponse {
    const NSID: &'static str = "app.rocksky.spotify.getCurrentlyPlaying";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = GetCurrentlyPlayingOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl<'a> jacquard_common::xrpc::XrpcRequest for GetCurrentlyPlaying<'a> {
    const NSID: &'static str = "app.rocksky.spotify.getCurrentlyPlaying";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetCurrentlyPlayingResponse;
}

/// Endpoint type for app.rocksky.spotify.getCurrentlyPlaying
pub struct GetCurrentlyPlayingRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetCurrentlyPlayingRequest {
    const PATH: &'static str = "/xrpc/app.rocksky.spotify.getCurrentlyPlaying";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<'de> = GetCurrentlyPlaying<'de>;
    type Response = GetCurrentlyPlayingResponse;
}

pub mod get_currently_playing_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 {}
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {}
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {}
}

/// Builder for constructing an instance of this type
pub struct GetCurrentlyPlayingBuilder<'a, S: get_currently_playing_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<AtIdentifier<'a>>,),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> GetCurrentlyPlaying<'a> {
    /// Create a new builder for this type
    pub fn new() -> GetCurrentlyPlayingBuilder<'a, get_currently_playing_state::Empty> {
        GetCurrentlyPlayingBuilder::new()
    }
}

impl<'a> GetCurrentlyPlayingBuilder<'a, get_currently_playing_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        GetCurrentlyPlayingBuilder {
            _state: PhantomData,
            _fields: (None,),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: get_currently_playing_state::State> GetCurrentlyPlayingBuilder<'a, S> {
    /// Set the `actor` field (optional)
    pub fn actor(mut self, value: impl Into<Option<AtIdentifier<'a>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `actor` field to an Option value (optional)
    pub fn maybe_actor(mut self, value: Option<AtIdentifier<'a>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S> GetCurrentlyPlayingBuilder<'a, S>
where
    S: get_currently_playing_state::State,
{
    /// Build the final struct
    pub fn build(self) -> GetCurrentlyPlaying<'a> {
        GetCurrentlyPlaying {
            actor: self._fields.0,
        }
    }
}