// @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::{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};
use crate::app_bsky::video::JobStatus;

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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct UploadVideoOutput<S: BosStr = DefaultStr> {
    pub job_status: JobStatus<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/** Response marker for the `app.bsky.video.uploadVideo` procedure.

Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `UploadVideoOutput<S>` for this endpoint.*/
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<S: BosStr> = UploadVideoOutput<S>;
    type Err = jacquard_common::xrpc::GenericError;
}

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,
        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 `app.bsky.video.uploadVideo` procedure.

Path: `/xrpc/app.bsky.video.uploadVideo`. The request payload type is `UploadVideo`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
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<S: BosStr> = UploadVideo;
    type Response = UploadVideoResponse;
}