// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: at.inlay.Throw
//
// 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};
use crate::at_inlay::Response;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Throw<'a> {
    ///Human-readable error message
    #[serde(borrow)]
    pub message: CowStr<'a>,
    ///Stack trace, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub stack: Option<CowStr<'a>>,
}


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

/// Response type for at.inlay.Throw
pub struct ThrowResponse;
impl jacquard_common::xrpc::XrpcResp for ThrowResponse {
    const NSID: &'static str = "at.inlay.Throw";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = ThrowOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl<'a> jacquard_common::xrpc::XrpcRequest for Throw<'a> {
    const NSID: &'static str = "at.inlay.Throw";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Response = ThrowResponse;
}

/// Endpoint type for at.inlay.Throw
pub struct ThrowRequest;
impl jacquard_common::xrpc::XrpcEndpoint for ThrowRequest {
    const PATH: &'static str = "/xrpc/at.inlay.Throw";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Request<'de> = Throw<'de>;
    type Response = ThrowResponse;
}