// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: sh.tangled.knot.version
//
// 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;
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct VersionOutput<'a> {
    #[serde(borrow)]
    pub version: CowStr<'a>,
}


#[jacquard_derive::open_union]
#[derive(
    Serialize,
    Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    thiserror::Error,
    miette::Diagnostic,
    IntoStatic
)]

#[serde(tag = "error", content = "message")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum VersionError<'a> {}
impl core::fmt::Display for VersionError<'_> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        match self {
            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
        }
    }
}

/// XRPC request marker type.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]
pub struct Version;
/// Response type for sh.tangled.knot.version
pub struct VersionResponse;
impl jacquard_common::xrpc::XrpcResp for VersionResponse {
    const NSID: &'static str = "sh.tangled.knot.version";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = VersionOutput<'de>;
    type Err<'de> = VersionError<'de>;
}

impl jacquard_common::xrpc::XrpcRequest for Version {
    const NSID: &'static str = "sh.tangled.knot.version";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = VersionResponse;
}

/// Endpoint type for sh.tangled.knot.version
pub struct VersionRequest;
impl jacquard_common::xrpc::XrpcEndpoint for VersionRequest {
    const PATH: &'static str = "/xrpc/sh.tangled.knot.version";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<'de> = Version;
    type Response = VersionResponse;
}