// @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 alloc::collections::BTreeMap;

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::bytes::Bytes;
use jacquard_common::deps::smol_str::SmolStr;
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 Sign {
    pub body: Bytes,
}


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

/** Response marker for the `garden.lexicon.ngerakines.semeion.Sign` procedure.

Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `SignOutput` for this endpoint.*/
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<S: BosStr> = SignOutput;
    type Err = jacquard_common::xrpc::GenericError;
    fn encode_output<S: BosStr>(
        output: &Self::Output<S>,
    ) -> Result<Vec<u8>, jacquard_common::xrpc::EncodeError>
    where
        Self::Output<S>: Serialize,
    {
        Ok(output.body.to_vec())
    }
    fn decode_output<'de, S>(
        body: &'de [u8],
    ) -> Result<Self::Output<S>, jacquard_common::error::DecodeError>
    where
        S: BosStr + Deserialize<'de>,
        Self::Output<S>: 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,
        buffer: &mut Vec<u8>,
    ) -> Result<(), jacquard_common::xrpc::EncodeError>
    where
        Self: Serialize,
    {
        Ok(buffer.copy_from_slice(self.body.as_ref()))
    }
    fn decode_body<'de>(
        body: &'de [u8],
    ) -> Result<Self, jacquard_common::error::DecodeError>
    where
        Self: Deserialize<'de>,
    {
        Ok(Self {
            body: jacquard_common::deps::bytes::Bytes::copy_from_slice(body),
        })
    }
}

/** Endpoint marker for the `garden.lexicon.ngerakines.semeion.Sign` procedure.

Path: `/xrpc/garden.lexicon.ngerakines.semeion.Sign`. The request payload type is `Sign`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
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<S: BosStr> = Sign;
    type Response = SignResponse;
}