// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: network.slices.slice.startSync
//
// 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_common::types::string::{Did, Nsid};
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct StartSync<'a> {
    ///List of collection NSIDs to sync (primary collections matching slice domain)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub collections: Option<Vec<Nsid<'a>>>,
    ///List of external collection NSIDs to sync (collections outside slice domain)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub external_collections: Option<Vec<Nsid<'a>>>,
    ///Maximum number of records to sync per repository
    #[serde(skip_serializing_if = "Option::is_none")]
    pub limit_per_repo: Option<i64>,
    ///List of specific repository DIDs to sync from
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub repos: Option<Vec<Did<'a>>>,
    ///Skip lexicon validation during sync  Defaults to `false`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_start_sync_skip_validation")]
    pub skip_validation: Option<bool>,
    ///AT-URI of the slice to sync data into
    #[serde(borrow)]
    pub slice: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct StartSyncOutput<'a> {
    ///UUID of the enqueued sync job
    #[serde(borrow)]
    pub job_id: CowStr<'a>,
    ///Success message confirming job enqueue
    #[serde(borrow)]
    pub message: CowStr<'a>,
}

/// Response type for network.slices.slice.startSync
pub struct StartSyncResponse;
impl jacquard_common::xrpc::XrpcResp for StartSyncResponse {
    const NSID: &'static str = "network.slices.slice.startSync";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = StartSyncOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl<'a> jacquard_common::xrpc::XrpcRequest for StartSync<'a> {
    const NSID: &'static str = "network.slices.slice.startSync";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Response = StartSyncResponse;
}

/// Endpoint type for network.slices.slice.startSync
pub struct StartSyncRequest;
impl jacquard_common::xrpc::XrpcEndpoint for StartSyncRequest {
    const PATH: &'static str = "/xrpc/network.slices.slice.startSync";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Request<'de> = StartSync<'de>;
    type Response = StartSyncResponse;
}

fn _default_start_sync_skip_validation() -> Option<bool> {
    Some(false)
}