// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.rocksky.googledrive.getFiles
//
// 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::CowStr;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
use crate::app_rocksky::googledrive::FileListView;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetFiles<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub at: Option<CowStr<'a>>,
}


#[jacquard_derive::lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetFilesOutput<'a> {
    #[serde(flatten)]
    #[serde(borrow)]
    pub value: FileListView<'a>,
}

/// Response type for app.rocksky.googledrive.getFiles
pub struct GetFilesResponse;
impl jacquard_common::xrpc::XrpcResp for GetFilesResponse {
    const NSID: &'static str = "app.rocksky.googledrive.getFiles";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = GetFilesOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl<'a> jacquard_common::xrpc::XrpcRequest for GetFiles<'a> {
    const NSID: &'static str = "app.rocksky.googledrive.getFiles";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetFilesResponse;
}

/// Endpoint type for app.rocksky.googledrive.getFiles
pub struct GetFilesRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetFilesRequest {
    const PATH: &'static str = "/xrpc/app.rocksky.googledrive.getFiles";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<'de> = GetFiles<'de>;
    type Response = GetFilesResponse;
}

pub mod get_files_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {}
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {}
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {}
}

/// Builder for constructing an instance of this type
pub struct GetFilesBuilder<'a, S: get_files_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<CowStr<'a>>,),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> GetFiles<'a> {
    /// Create a new builder for this type
    pub fn new() -> GetFilesBuilder<'a, get_files_state::Empty> {
        GetFilesBuilder::new()
    }
}

impl<'a> GetFilesBuilder<'a, get_files_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        GetFilesBuilder {
            _state: PhantomData,
            _fields: (None,),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: get_files_state::State> GetFilesBuilder<'a, S> {
    /// Set the `at` field (optional)
    pub fn at(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `at` field to an Option value (optional)
    pub fn maybe_at(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S> GetFilesBuilder<'a, S>
where
    S: get_files_state::State,
{
    /// Build the final struct
    pub fn build(self) -> GetFiles<'a> {
        GetFiles { at: self._fields.0 }
    }
}