pub mod game;
pub mod key;
pub mod player;
pub mod verification;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::Datetime;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SyncStatus<'a> {
pub created_at: Datetime,
#[serde(borrow)]
pub hash: CowStr<'a>,
#[serde(default = "_default_sync_status_synced_with_at_repo")]
pub synced_with_at_repo: bool,
pub updated_at: Datetime,
}
impl<'a> LexiconSchema for SyncStatus<'a> {
fn nsid() -> &'static str {
"blue.2048.defs"
}
fn def_name() -> &'static str {
"syncStatus"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_blue_2048_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
fn _default_sync_status_synced_with_at_repo() -> bool {
false
}
pub mod sync_status_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 SyncedWithAtRepo;
type UpdatedAt;
type Hash;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type SyncedWithAtRepo = Unset;
type UpdatedAt = Unset;
type Hash = Unset;
type CreatedAt = Unset;
}
pub struct SetSyncedWithAtRepo<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSyncedWithAtRepo<S> {}
impl<S: State> State for SetSyncedWithAtRepo<S> {
type SyncedWithAtRepo = Set<members::synced_with_at_repo>;
type UpdatedAt = S::UpdatedAt;
type Hash = S::Hash;
type CreatedAt = S::CreatedAt;
}
pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUpdatedAt<S> {}
impl<S: State> State for SetUpdatedAt<S> {
type SyncedWithAtRepo = S::SyncedWithAtRepo;
type UpdatedAt = Set<members::updated_at>;
type Hash = S::Hash;
type CreatedAt = S::CreatedAt;
}
pub struct SetHash<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHash<S> {}
impl<S: State> State for SetHash<S> {
type SyncedWithAtRepo = S::SyncedWithAtRepo;
type UpdatedAt = S::UpdatedAt;
type Hash = Set<members::hash>;
type CreatedAt = S::CreatedAt;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type SyncedWithAtRepo = S::SyncedWithAtRepo;
type UpdatedAt = S::UpdatedAt;
type Hash = S::Hash;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct synced_with_at_repo(());
pub struct updated_at(());
pub struct hash(());
pub struct created_at(());
}
}
pub struct SyncStatusBuilder<'a, S: sync_status_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Datetime>, Option<CowStr<'a>>, Option<bool>, Option<Datetime>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> SyncStatus<'a> {
pub fn new() -> SyncStatusBuilder<'a, sync_status_state::Empty> {
SyncStatusBuilder::new()
}
}
impl<'a> SyncStatusBuilder<'a, sync_status_state::Empty> {
pub fn new() -> Self {
SyncStatusBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> SyncStatusBuilder<'a, S>
where
S: sync_status_state::State,
S::CreatedAt: sync_status_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> SyncStatusBuilder<'a, sync_status_state::SetCreatedAt<S>> {
self._fields.0 = Option::Some(value.into());
SyncStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SyncStatusBuilder<'a, S>
where
S: sync_status_state::State,
S::Hash: sync_status_state::IsUnset,
{
pub fn hash(
mut self,
value: impl Into<CowStr<'a>>,
) -> SyncStatusBuilder<'a, sync_status_state::SetHash<S>> {
self._fields.1 = Option::Some(value.into());
SyncStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SyncStatusBuilder<'a, S>
where
S: sync_status_state::State,
S::SyncedWithAtRepo: sync_status_state::IsUnset,
{
pub fn synced_with_at_repo(
mut self,
value: impl Into<bool>,
) -> SyncStatusBuilder<'a, sync_status_state::SetSyncedWithAtRepo<S>> {
self._fields.2 = Option::Some(value.into());
SyncStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SyncStatusBuilder<'a, S>
where
S: sync_status_state::State,
S::UpdatedAt: sync_status_state::IsUnset,
{
pub fn updated_at(
mut self,
value: impl Into<Datetime>,
) -> SyncStatusBuilder<'a, sync_status_state::SetUpdatedAt<S>> {
self._fields.3 = Option::Some(value.into());
SyncStatusBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SyncStatusBuilder<'a, S>
where
S: sync_status_state::State,
S::SyncedWithAtRepo: sync_status_state::IsSet,
S::UpdatedAt: sync_status_state::IsSet,
S::Hash: sync_status_state::IsSet,
S::CreatedAt: sync_status_state::IsSet,
{
pub fn build(self) -> SyncStatus<'a> {
SyncStatus {
created_at: self._fields.0.unwrap(),
hash: self._fields.1.unwrap(),
synced_with_at_repo: self._fields.2.unwrap(),
updated_at: self._fields.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> SyncStatus<'a> {
SyncStatus {
created_at: self._fields.0.unwrap(),
hash: self._fields.1.unwrap(),
synced_with_at_repo: self._fields.2.unwrap(),
updated_at: self._fields.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_blue_2048_defs() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("blue.2048.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("syncStatus"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"The sync status for a record used to help sync between your ATProto record and local record.",
),
),
required: Some(
vec![
SmolStr::new_static("hash"),
SmolStr::new_static("updatedAt"),
SmolStr::new_static("createdAt"),
SmolStr::new_static("syncedWithATRepo")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("hash"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"A XXH3 hash of the record to tell if anything has changed",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("syncedWithATRepo"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}