// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.bsky.video.uploadVideo
//
// 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::deps::bytes::Bytes;
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};
use crate::app_bsky::video::JobStatus;

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


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

/// Response type for app.bsky.video.uploadVideo
pub struct UploadVideoResponse;
impl jacquard_common::xrpc::XrpcResp for UploadVideoResponse {
    const NSID: &'static str = "app.bsky.video.uploadVideo";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = UploadVideoOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl jacquard_common::xrpc::XrpcRequest for UploadVideo {
    const NSID: &'static str = "app.bsky.video.uploadVideo";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "video/mp4",
    );
    type Response = UploadVideoResponse;
    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 app.bsky.video.uploadVideo
pub struct UploadVideoRequest;
impl jacquard_common::xrpc::XrpcEndpoint for UploadVideoRequest {
    const PATH: &'static str = "/xrpc/app.bsky.video.uploadVideo";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "video/mp4",
    );
    type Request<'de> = UploadVideo;
    type Response = UploadVideoResponse;
}