// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.bsky.notification.getUnreadCount
//
// 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::{BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Datetime;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetUnreadCount {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priority: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub seen_at: Option<Datetime>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetUnreadCountOutput<S: BosStr = DefaultStr> {
    pub count: i64,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/** Response marker for the `app.bsky.notification.getUnreadCount` query.

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

impl jacquard_common::xrpc::XrpcRequest for GetUnreadCount {
    const NSID: &'static str = "app.bsky.notification.getUnreadCount";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetUnreadCountResponse;
}

/** Endpoint marker for the `app.bsky.notification.getUnreadCount` query.

Path: `/xrpc/app.bsky.notification.getUnreadCount`. The request payload type is `GetUnreadCount`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
pub struct GetUnreadCountRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetUnreadCountRequest {
    const PATH: &'static str = "/xrpc/app.bsky.notification.getUnreadCount";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<S: BosStr> = GetUnreadCount;
    type Response = GetUnreadCountResponse;
}

pub mod get_unread_count_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 GetUnreadCountBuilder<St: get_unread_count_state::State> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<bool>, Option<Datetime>),
}

impl GetUnreadCount {
    /// Create a new builder for this type.
    pub fn new() -> GetUnreadCountBuilder<get_unread_count_state::Empty> {
        GetUnreadCountBuilder::new()
    }
}

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

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

impl<St: get_unread_count_state::State> GetUnreadCountBuilder<St> {
    /// Set the `priority` field (optional)
    pub fn priority(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `priority` field to an Option value (optional)
    pub fn maybe_priority(mut self, value: Option<bool>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St: get_unread_count_state::State> GetUnreadCountBuilder<St> {
    /// Set the `seenAt` field (optional)
    pub fn seen_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `seenAt` field to an Option value (optional)
    pub fn maybe_seen_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St> GetUnreadCountBuilder<St>
where
    St: get_unread_count_state::State,
{
    /// Build the final struct.
    pub fn build(self) -> GetUnreadCount {
        GetUnreadCount {
            priority: self._fields.0,
            seen_at: self._fields.1,
        }
    }
}