// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: chat.firehose.getUserChannels
//
// 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};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
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};
use crate::chat_firehose::get_user_channels;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Channel<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub uri: Option<S>,
    #[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 GetUserChannelsOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub channels: Option<Vec<get_user_channels::Channel<S>>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

impl<S: BosStr> LexiconSchema for Channel<S> {
    fn nsid() -> &'static str {
        "chat.firehose.getUserChannels"
    }
    fn def_name() -> &'static str {
        "channel"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_firehose_getUserChannels()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

/** Request marker for the `chat.firehose.getUserChannels` query.

This endpoint has no request parameters or input body; send this marker with `jacquard::Client`.*/

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]
pub struct GetUserChannels;
/** Response marker for the `chat.firehose.getUserChannels` query.

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

impl jacquard_common::xrpc::XrpcRequest for GetUserChannels {
    const NSID: &'static str = "chat.firehose.getUserChannels";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetUserChannelsResponse;
}

/** Endpoint marker for the `chat.firehose.getUserChannels` query.

Path: `/xrpc/chat.firehose.getUserChannels`. The request payload type is `GetUserChannels`; use this marker with lower-level `XrpcEndpoint` APIs when you need endpoint metadata.*/
pub struct GetUserChannelsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetUserChannelsRequest {
    const PATH: &'static str = "/xrpc/chat.firehose.getUserChannels";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<S: BosStr> = GetUserChannels;
    type Response = GetUserChannelsResponse;
}

fn lexicon_doc_chat_firehose_getUserChannels() -> 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("chat.firehose.getUserChannels"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("channel"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::XrpcQuery(LexXrpcQuery {
                    parameters: None,
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}