#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};
use crate::app_bsky::ageassurance::State;
use crate::app_bsky::ageassurance::StateMetadata;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetState<'a> {
#[serde(borrow)]
pub country_code: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub region_code: Option<CowStr<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetStateOutput<'a> {
#[serde(borrow)]
pub metadata: StateMetadata<'a>,
#[serde(borrow)]
pub state: State<'a>,
}
pub struct GetStateResponse;
impl jacquard_common::xrpc::XrpcResp for GetStateResponse {
const NSID: &'static str = "app.bsky.ageassurance.getState";
const ENCODING: &'static str = "application/json";
type Output<'de> = GetStateOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for GetState<'a> {
const NSID: &'static str = "app.bsky.ageassurance.getState";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetStateResponse;
}
pub struct GetStateRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetStateRequest {
const PATH: &'static str = "/xrpc/app.bsky.ageassurance.getState";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<'de> = GetState<'de>;
type Response = GetStateResponse;
}
pub mod get_state_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type CountryCode;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CountryCode = Unset;
}
pub struct SetCountryCode<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCountryCode<S> {}
impl<S: State> State for SetCountryCode<S> {
type CountryCode = Set<members::country_code>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct country_code(());
}
}
pub struct GetStateBuilder<'a, S: get_state_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<CowStr<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> GetState<'a> {
pub fn new() -> GetStateBuilder<'a, get_state_state::Empty> {
GetStateBuilder::new()
}
}
impl<'a> GetStateBuilder<'a, get_state_state::Empty> {
pub fn new() -> Self {
GetStateBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> GetStateBuilder<'a, S>
where
S: get_state_state::State,
S::CountryCode: get_state_state::IsUnset,
{
pub fn country_code(
mut self,
value: impl Into<CowStr<'a>>,
) -> GetStateBuilder<'a, get_state_state::SetCountryCode<S>> {
self._fields.0 = Option::Some(value.into());
GetStateBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: get_state_state::State> GetStateBuilder<'a, S> {
pub fn region_code(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_region_code(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> GetStateBuilder<'a, S>
where
S: get_state_state::State,
S::CountryCode: get_state_state::IsSet,
{
pub fn build(self) -> GetState<'a> {
GetState {
country_code: self._fields.0.unwrap(),
region_code: self._fields.1,
}
}
}