// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: garden.lexicon.ngerakines.semeion.Sign
//
// 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::deps::bytes::Bytes;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Sign {
    pub body: Bytes,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SignOutput {
    pub body: Bytes,
}

/// Response type for garden.lexicon.ngerakines.semeion.Sign
pub struct SignResponse;
impl jacquard_common::xrpc::XrpcResp for SignResponse {
    const NSID: &'static str = "garden.lexicon.ngerakines.semeion.Sign";
    const ENCODING: &'static str = "application/octet-stream";
    type Output<'de> = SignOutput;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
    fn encode_output(
        output: &Self::Output<'_>,
    ) -> Result<Vec<u8>, jacquard_common::xrpc::EncodeError> {
        Ok(output.body.to_vec())
    }
    fn decode_output<'de>(
        body: &'de [u8],
    ) -> Result<Self::Output<'de>, jacquard_common::error::DecodeError>
    where
        Self::Output<'de>: serde::Deserialize<'de>,
    {
        Ok(SignOutput {
            body: jacquard_common::deps::bytes::Bytes::copy_from_slice(body),
        })
    }
}

impl jacquard_common::xrpc::XrpcRequest for Sign {
    const NSID: &'static str = "garden.lexicon.ngerakines.semeion.Sign";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "*/*",
    );
    type Response = SignResponse;
    fn encode_body(&self) -> Result<Vec<u8>, jacquard_common::xrpc::EncodeError> {
        Ok(self.body.to_vec())
    }
    fn decode_body<'de>(
        body: &'de [u8],
    ) -> Result<Box<Self>, jacquard_common::error::DecodeError>
    where
        Self: serde::Deserialize<'de>,
    {
        Ok(
            Box::new(Self {
                body: jacquard_common::deps::bytes::Bytes::copy_from_slice(body),
            }),
        )
    }
}

/// Endpoint type for garden.lexicon.ngerakines.semeion.Sign
pub struct SignRequest;
impl jacquard_common::xrpc::XrpcEndpoint for SignRequest {
    const PATH: &'static str = "/xrpc/garden.lexicon.ngerakines.semeion.Sign";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "*/*",
    );
    type Request<'de> = Sign;
    type Response = SignResponse;
}