#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::net_anisota::chronicle::log::daily;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ActivityCounts<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub likes_sent: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub posts_created: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub posts_read: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub replies_sent: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reposts_sent: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ChronicleSignature<S: BosStr = DefaultStr> {
pub alg: S,
pub kid: S,
pub nonce: S,
pub sig: S,
pub signed_at: Datetime,
pub version: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct EngagementCounts<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub likes_received: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub quotes_received: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub replies_received: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reposts_received: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ExpeditionSummary<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub current_camp_number: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub current_expedition_number: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub total_duration: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
rename = "net.anisota.chronicle.log.daily",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Daily<S: BosStr = DefaultStr> {
pub activity: daily::ActivityCounts<S>,
pub created_at: Datetime,
pub date: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub engagement: Option<daily::EngagementCounts<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub expedition_refs: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub expeditions: Option<daily::ExpeditionSummary<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub patterns: Option<daily::PatternsData<S>>,
pub player: daily::PlayerSnapshot<S>,
pub signature: daily::ChronicleSignature<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub upper_log_refs: Option<Vec<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DailyGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Daily<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct PatternsData<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub active_block_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub active_blocks: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub offline_xp_awarded: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct PlayerSnapshot<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub items_acquired_today: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub items_consumed_today: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub items_total: Option<i64>,
pub level: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub specimens_documented: Option<i64>,
pub total_xp: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub xp_gained_today: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> Daily<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, DailyRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
impl<S: BosStr> LexiconSchema for ActivityCounts<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.daily"
}
fn def_name() -> &'static str {
"activityCounts"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_daily()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.likes_sent {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("likes_sent"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.posts_created {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("posts_created"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.posts_read {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("posts_read"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.replies_sent {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("replies_sent"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.reposts_sent {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("reposts_sent"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ChronicleSignature<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.daily"
}
fn def_name() -> &'static str {
"chronicleSignature"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_daily()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for EngagementCounts<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.daily"
}
fn def_name() -> &'static str {
"engagementCounts"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_daily()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.likes_received {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("likes_received"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.quotes_received {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("quotes_received"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.replies_received {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("replies_received"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.reposts_received {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("reposts_received"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ExpeditionSummary<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.daily"
}
fn def_name() -> &'static str {
"expeditionSummary"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_daily()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.count {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("count"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.current_camp_number {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("current_camp_number"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.current_expedition_number {
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("current_expedition_number"),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.total_duration {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("total_duration"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DailyRecord;
impl XrpcResp for DailyRecord {
const NSID: &'static str = "net.anisota.chronicle.log.daily";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = DailyGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<DailyGetRecordOutput<S>> for Daily<S> {
fn from(output: DailyGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Daily<S> {
const NSID: &'static str = "net.anisota.chronicle.log.daily";
type Record = DailyRecord;
}
impl Collection for DailyRecord {
const NSID: &'static str = "net.anisota.chronicle.log.daily";
type Record = DailyRecord;
}
impl<S: BosStr> LexiconSchema for Daily<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.daily"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_daily()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for PatternsData<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.daily"
}
fn def_name() -> &'static str {
"patternsData"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_daily()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.active_block_count {
if *value > 48i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("active_block_count"),
max: 48i64,
actual: *value,
});
}
}
if let Some(ref value) = self.active_block_count {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("active_block_count"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.active_blocks {
#[allow(unused_comparisons)]
if value.len() > 48usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("active_blocks"),
max: 48usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.offline_xp_awarded {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("offline_xp_awarded"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for PlayerSnapshot<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.daily"
}
fn def_name() -> &'static str {
"playerSnapshot"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_daily()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.items_acquired_today {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("items_acquired_today"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.items_consumed_today {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("items_consumed_today"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.items_total {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("items_total"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.level;
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("level"),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.specimens_documented {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("specimens_documented"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.total_xp;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("total_xp"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.xp_gained_today {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("xp_gained_today"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
fn lexicon_doc_net_anisota_chronicle_log_daily() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("net.anisota.chronicle.log.daily"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("activityCounts"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Aggregate activity counts for the day (no timestamps or URIs)",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("likesSent"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("postsCreated"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("postsRead"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repliesSent"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repostsSent"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("chronicleSignature"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"ES256 cryptographic signature proving record authenticity",
)),
required: Some(vec![
SmolStr::new_static("sig"),
SmolStr::new_static("alg"),
SmolStr::new_static("kid"),
SmolStr::new_static("signedAt"),
SmolStr::new_static("nonce"),
SmolStr::new_static("version"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("alg"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Signing algorithm (ES256)")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("kid"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Key identifier for the signing key",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("nonce"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Unique random nonce to prevent replay",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("sig"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Base64-encoded ES256 signature",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("signedAt"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("When the record was signed")),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("version"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("engagementCounts"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Engagement received on user's posts (aggregate counts only)",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("likesReceived"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("quotesReceived"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repliesReceived"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repostsReceived"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("expeditionSummary"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Summary of expeditions for the day (details in chronicle.expedition)",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("count"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("currentCampNumber"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("currentExpeditionNumber"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("totalDuration"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
description: Some(
CowStr::new_static(
"Daily activity snapshot. Updated throughout the day via putRecord. rkey is YYYY-MM-DD in user's local timezone.",
),
),
key: Some(CowStr::new_static("any")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("date"), SmolStr::new_static("player"),
SmolStr::new_static("activity"),
SmolStr::new_static("signature"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("activity"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#activityCounts"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"When the daily record was first created",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("date"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Date string in YYYY-MM-DD format (user's local timezone)",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("engagement"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#engagementCounts"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("expeditionRefs"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"AT URIs of expedition records that occurred on this day",
),
),
items: LexArrayItem::String(LexString {
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("expeditions"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#expeditionSummary"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("patterns"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#patternsData"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("player"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#playerSnapshot"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("signature"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#chronicleSignature"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When the daily record was last updated"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("upperLogRefs"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"AT URIs of containing logs (weekly, monthly, yearly) this day belongs to",
),
),
items: LexArrayItem::String(LexString {
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("patternsData"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Activity pattern data for the day based on half-hour blocks",
),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("activeBlockCount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(48i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("activeBlocks"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Half-hour slots with activity, as HH:MM strings (e.g. '09:00', '09:30'). Max 48 per day.",
),
),
items: LexArrayItem::String(LexString {
..Default::default()
}),
max_length: Some(48usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("offlineXPAwarded"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("playerSnapshot"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Player state snapshot for this day")),
required: Some(vec![
SmolStr::new_static("level"),
SmolStr::new_static("totalXP"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("itemsAcquiredToday"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("itemsConsumedToday"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("itemsTotal"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("level"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("specimensDocumented"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("totalXP"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("xpGainedToday"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod chronicle_signature_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Alg;
type Kid;
type Nonce;
type Sig;
type SignedAt;
type Version;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Alg = Unset;
type Kid = Unset;
type Nonce = Unset;
type Sig = Unset;
type SignedAt = Unset;
type Version = Unset;
}
pub struct SetAlg<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAlg<St> {}
impl<St: State> State for SetAlg<St> {
type Alg = Set<members::alg>;
type Kid = St::Kid;
type Nonce = St::Nonce;
type Sig = St::Sig;
type SignedAt = St::SignedAt;
type Version = St::Version;
}
pub struct SetKid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetKid<St> {}
impl<St: State> State for SetKid<St> {
type Alg = St::Alg;
type Kid = Set<members::kid>;
type Nonce = St::Nonce;
type Sig = St::Sig;
type SignedAt = St::SignedAt;
type Version = St::Version;
}
pub struct SetNonce<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetNonce<St> {}
impl<St: State> State for SetNonce<St> {
type Alg = St::Alg;
type Kid = St::Kid;
type Nonce = Set<members::nonce>;
type Sig = St::Sig;
type SignedAt = St::SignedAt;
type Version = St::Version;
}
pub struct SetSig<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSig<St> {}
impl<St: State> State for SetSig<St> {
type Alg = St::Alg;
type Kid = St::Kid;
type Nonce = St::Nonce;
type Sig = Set<members::sig>;
type SignedAt = St::SignedAt;
type Version = St::Version;
}
pub struct SetSignedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSignedAt<St> {}
impl<St: State> State for SetSignedAt<St> {
type Alg = St::Alg;
type Kid = St::Kid;
type Nonce = St::Nonce;
type Sig = St::Sig;
type SignedAt = Set<members::signed_at>;
type Version = St::Version;
}
pub struct SetVersion<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetVersion<St> {}
impl<St: State> State for SetVersion<St> {
type Alg = St::Alg;
type Kid = St::Kid;
type Nonce = St::Nonce;
type Sig = St::Sig;
type SignedAt = St::SignedAt;
type Version = Set<members::version>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct alg(());
pub struct kid(());
pub struct nonce(());
pub struct sig(());
pub struct signed_at(());
pub struct version(());
}
}
pub struct ChronicleSignatureBuilder<St: chronicle_signature_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<Datetime>,
Option<i64>,
),
_type: PhantomData<fn() -> S>,
}
impl ChronicleSignature<DefaultStr> {
pub fn new() -> ChronicleSignatureBuilder<chronicle_signature_state::Empty, DefaultStr> {
ChronicleSignatureBuilder::new()
}
}
impl<S: BosStr> ChronicleSignature<S> {
pub fn builder() -> ChronicleSignatureBuilder<chronicle_signature_state::Empty, S> {
ChronicleSignatureBuilder::builder()
}
}
impl ChronicleSignatureBuilder<chronicle_signature_state::Empty, DefaultStr> {
pub fn new() -> Self {
ChronicleSignatureBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> ChronicleSignatureBuilder<chronicle_signature_state::Empty, S> {
pub fn builder() -> Self {
ChronicleSignatureBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ChronicleSignatureBuilder<St, S>
where
St: chronicle_signature_state::State,
St::Alg: chronicle_signature_state::IsUnset,
{
pub fn alg(
mut self,
value: impl Into<S>,
) -> ChronicleSignatureBuilder<chronicle_signature_state::SetAlg<St>, S> {
self._fields.0 = Option::Some(value.into());
ChronicleSignatureBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ChronicleSignatureBuilder<St, S>
where
St: chronicle_signature_state::State,
St::Kid: chronicle_signature_state::IsUnset,
{
pub fn kid(
mut self,
value: impl Into<S>,
) -> ChronicleSignatureBuilder<chronicle_signature_state::SetKid<St>, S> {
self._fields.1 = Option::Some(value.into());
ChronicleSignatureBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ChronicleSignatureBuilder<St, S>
where
St: chronicle_signature_state::State,
St::Nonce: chronicle_signature_state::IsUnset,
{
pub fn nonce(
mut self,
value: impl Into<S>,
) -> ChronicleSignatureBuilder<chronicle_signature_state::SetNonce<St>, S> {
self._fields.2 = Option::Some(value.into());
ChronicleSignatureBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ChronicleSignatureBuilder<St, S>
where
St: chronicle_signature_state::State,
St::Sig: chronicle_signature_state::IsUnset,
{
pub fn sig(
mut self,
value: impl Into<S>,
) -> ChronicleSignatureBuilder<chronicle_signature_state::SetSig<St>, S> {
self._fields.3 = Option::Some(value.into());
ChronicleSignatureBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ChronicleSignatureBuilder<St, S>
where
St: chronicle_signature_state::State,
St::SignedAt: chronicle_signature_state::IsUnset,
{
pub fn signed_at(
mut self,
value: impl Into<Datetime>,
) -> ChronicleSignatureBuilder<chronicle_signature_state::SetSignedAt<St>, S> {
self._fields.4 = Option::Some(value.into());
ChronicleSignatureBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ChronicleSignatureBuilder<St, S>
where
St: chronicle_signature_state::State,
St::Version: chronicle_signature_state::IsUnset,
{
pub fn version(
mut self,
value: impl Into<i64>,
) -> ChronicleSignatureBuilder<chronicle_signature_state::SetVersion<St>, S> {
self._fields.5 = Option::Some(value.into());
ChronicleSignatureBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> ChronicleSignatureBuilder<St, S>
where
St: chronicle_signature_state::State,
St::Alg: chronicle_signature_state::IsSet,
St::Kid: chronicle_signature_state::IsSet,
St::Nonce: chronicle_signature_state::IsSet,
St::Sig: chronicle_signature_state::IsSet,
St::SignedAt: chronicle_signature_state::IsSet,
St::Version: chronicle_signature_state::IsSet,
{
pub fn build(self) -> ChronicleSignature<S> {
ChronicleSignature {
alg: self._fields.0.unwrap(),
kid: self._fields.1.unwrap(),
nonce: self._fields.2.unwrap(),
sig: self._fields.3.unwrap(),
signed_at: self._fields.4.unwrap(),
version: self._fields.5.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ChronicleSignature<S> {
ChronicleSignature {
alg: self._fields.0.unwrap(),
kid: self._fields.1.unwrap(),
nonce: self._fields.2.unwrap(),
sig: self._fields.3.unwrap(),
signed_at: self._fields.4.unwrap(),
version: self._fields.5.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod daily_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Activity;
type CreatedAt;
type Date;
type Player;
type Signature;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Activity = Unset;
type CreatedAt = Unset;
type Date = Unset;
type Player = Unset;
type Signature = Unset;
}
pub struct SetActivity<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetActivity<St> {}
impl<St: State> State for SetActivity<St> {
type Activity = Set<members::activity>;
type CreatedAt = St::CreatedAt;
type Date = St::Date;
type Player = St::Player;
type Signature = St::Signature;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type Activity = St::Activity;
type CreatedAt = Set<members::created_at>;
type Date = St::Date;
type Player = St::Player;
type Signature = St::Signature;
}
pub struct SetDate<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDate<St> {}
impl<St: State> State for SetDate<St> {
type Activity = St::Activity;
type CreatedAt = St::CreatedAt;
type Date = Set<members::date>;
type Player = St::Player;
type Signature = St::Signature;
}
pub struct SetPlayer<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPlayer<St> {}
impl<St: State> State for SetPlayer<St> {
type Activity = St::Activity;
type CreatedAt = St::CreatedAt;
type Date = St::Date;
type Player = Set<members::player>;
type Signature = St::Signature;
}
pub struct SetSignature<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSignature<St> {}
impl<St: State> State for SetSignature<St> {
type Activity = St::Activity;
type CreatedAt = St::CreatedAt;
type Date = St::Date;
type Player = St::Player;
type Signature = Set<members::signature>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct activity(());
pub struct created_at(());
pub struct date(());
pub struct player(());
pub struct signature(());
}
}
pub struct DailyBuilder<St: daily_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<daily::ActivityCounts<S>>,
Option<Datetime>,
Option<S>,
Option<daily::EngagementCounts<S>>,
Option<Vec<S>>,
Option<daily::ExpeditionSummary<S>>,
Option<daily::PatternsData<S>>,
Option<daily::PlayerSnapshot<S>>,
Option<daily::ChronicleSignature<S>>,
Option<Datetime>,
Option<Vec<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl Daily<DefaultStr> {
pub fn new() -> DailyBuilder<daily_state::Empty, DefaultStr> {
DailyBuilder::new()
}
}
impl<S: BosStr> Daily<S> {
pub fn builder() -> DailyBuilder<daily_state::Empty, S> {
DailyBuilder::builder()
}
}
impl DailyBuilder<daily_state::Empty, DefaultStr> {
pub fn new() -> Self {
DailyBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr> DailyBuilder<daily_state::Empty, S> {
pub fn builder() -> Self {
DailyBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None,
),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> DailyBuilder<St, S>
where
St: daily_state::State,
St::Activity: daily_state::IsUnset,
{
pub fn activity(
mut self,
value: impl Into<daily::ActivityCounts<S>>,
) -> DailyBuilder<daily_state::SetActivity<St>, S> {
self._fields.0 = Option::Some(value.into());
DailyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> DailyBuilder<St, S>
where
St: daily_state::State,
St::CreatedAt: daily_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> DailyBuilder<daily_state::SetCreatedAt<St>, S> {
self._fields.1 = Option::Some(value.into());
DailyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> DailyBuilder<St, S>
where
St: daily_state::State,
St::Date: daily_state::IsUnset,
{
pub fn date(mut self, value: impl Into<S>) -> DailyBuilder<daily_state::SetDate<St>, S> {
self._fields.2 = Option::Some(value.into());
DailyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: daily_state::State, S: BosStr> DailyBuilder<St, S> {
pub fn engagement(mut self, value: impl Into<Option<daily::EngagementCounts<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_engagement(mut self, value: Option<daily::EngagementCounts<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<St: daily_state::State, S: BosStr> DailyBuilder<St, S> {
pub fn expedition_refs(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_expedition_refs(mut self, value: Option<Vec<S>>) -> Self {
self._fields.4 = value;
self
}
}
impl<St: daily_state::State, S: BosStr> DailyBuilder<St, S> {
pub fn expeditions(mut self, value: impl Into<Option<daily::ExpeditionSummary<S>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_expeditions(mut self, value: Option<daily::ExpeditionSummary<S>>) -> Self {
self._fields.5 = value;
self
}
}
impl<St: daily_state::State, S: BosStr> DailyBuilder<St, S> {
pub fn patterns(mut self, value: impl Into<Option<daily::PatternsData<S>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_patterns(mut self, value: Option<daily::PatternsData<S>>) -> Self {
self._fields.6 = value;
self
}
}
impl<St, S: BosStr> DailyBuilder<St, S>
where
St: daily_state::State,
St::Player: daily_state::IsUnset,
{
pub fn player(
mut self,
value: impl Into<daily::PlayerSnapshot<S>>,
) -> DailyBuilder<daily_state::SetPlayer<St>, S> {
self._fields.7 = Option::Some(value.into());
DailyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> DailyBuilder<St, S>
where
St: daily_state::State,
St::Signature: daily_state::IsUnset,
{
pub fn signature(
mut self,
value: impl Into<daily::ChronicleSignature<S>>,
) -> DailyBuilder<daily_state::SetSignature<St>, S> {
self._fields.8 = Option::Some(value.into());
DailyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: daily_state::State, S: BosStr> DailyBuilder<St, S> {
pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
self._fields.9 = value;
self
}
}
impl<St: daily_state::State, S: BosStr> DailyBuilder<St, S> {
pub fn upper_log_refs(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_upper_log_refs(mut self, value: Option<Vec<S>>) -> Self {
self._fields.10 = value;
self
}
}
impl<St, S: BosStr> DailyBuilder<St, S>
where
St: daily_state::State,
St::Activity: daily_state::IsSet,
St::CreatedAt: daily_state::IsSet,
St::Date: daily_state::IsSet,
St::Player: daily_state::IsSet,
St::Signature: daily_state::IsSet,
{
pub fn build(self) -> Daily<S> {
Daily {
activity: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
date: self._fields.2.unwrap(),
engagement: self._fields.3,
expedition_refs: self._fields.4,
expeditions: self._fields.5,
patterns: self._fields.6,
player: self._fields.7.unwrap(),
signature: self._fields.8.unwrap(),
updated_at: self._fields.9,
upper_log_refs: self._fields.10,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Daily<S> {
Daily {
activity: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
date: self._fields.2.unwrap(),
engagement: self._fields.3,
expedition_refs: self._fields.4,
expeditions: self._fields.5,
patterns: self._fields.6,
player: self._fields.7.unwrap(),
signature: self._fields.8.unwrap(),
updated_at: self._fields.9,
upper_log_refs: self._fields.10,
extra_data: Some(extra_data),
}
}
}
pub mod player_snapshot_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Level;
type TotalXp;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Level = Unset;
type TotalXp = Unset;
}
pub struct SetLevel<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetLevel<St> {}
impl<St: State> State for SetLevel<St> {
type Level = Set<members::level>;
type TotalXp = St::TotalXp;
}
pub struct SetTotalXp<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTotalXp<St> {}
impl<St: State> State for SetTotalXp<St> {
type Level = St::Level;
type TotalXp = Set<members::total_xp>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct level(());
pub struct total_xp(());
}
}
pub struct PlayerSnapshotBuilder<St: player_snapshot_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<i64>,
Option<i64>,
Option<i64>,
Option<i64>,
Option<i64>,
Option<i64>,
Option<i64>,
),
_type: PhantomData<fn() -> S>,
}
impl PlayerSnapshot<DefaultStr> {
pub fn new() -> PlayerSnapshotBuilder<player_snapshot_state::Empty, DefaultStr> {
PlayerSnapshotBuilder::new()
}
}
impl<S: BosStr> PlayerSnapshot<S> {
pub fn builder() -> PlayerSnapshotBuilder<player_snapshot_state::Empty, S> {
PlayerSnapshotBuilder::builder()
}
}
impl PlayerSnapshotBuilder<player_snapshot_state::Empty, DefaultStr> {
pub fn new() -> Self {
PlayerSnapshotBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> PlayerSnapshotBuilder<player_snapshot_state::Empty, S> {
pub fn builder() -> Self {
PlayerSnapshotBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St: player_snapshot_state::State, S: BosStr> PlayerSnapshotBuilder<St, S> {
pub fn items_acquired_today(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_items_acquired_today(mut self, value: Option<i64>) -> Self {
self._fields.0 = value;
self
}
}
impl<St: player_snapshot_state::State, S: BosStr> PlayerSnapshotBuilder<St, S> {
pub fn items_consumed_today(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_items_consumed_today(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<St: player_snapshot_state::State, S: BosStr> PlayerSnapshotBuilder<St, S> {
pub fn items_total(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_items_total(mut self, value: Option<i64>) -> Self {
self._fields.2 = value;
self
}
}
impl<St, S: BosStr> PlayerSnapshotBuilder<St, S>
where
St: player_snapshot_state::State,
St::Level: player_snapshot_state::IsUnset,
{
pub fn level(
mut self,
value: impl Into<i64>,
) -> PlayerSnapshotBuilder<player_snapshot_state::SetLevel<St>, S> {
self._fields.3 = Option::Some(value.into());
PlayerSnapshotBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: player_snapshot_state::State, S: BosStr> PlayerSnapshotBuilder<St, S> {
pub fn specimens_documented(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_specimens_documented(mut self, value: Option<i64>) -> Self {
self._fields.4 = value;
self
}
}
impl<St, S: BosStr> PlayerSnapshotBuilder<St, S>
where
St: player_snapshot_state::State,
St::TotalXp: player_snapshot_state::IsUnset,
{
pub fn total_xp(
mut self,
value: impl Into<i64>,
) -> PlayerSnapshotBuilder<player_snapshot_state::SetTotalXp<St>, S> {
self._fields.5 = Option::Some(value.into());
PlayerSnapshotBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: player_snapshot_state::State, S: BosStr> PlayerSnapshotBuilder<St, S> {
pub fn xp_gained_today(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_xp_gained_today(mut self, value: Option<i64>) -> Self {
self._fields.6 = value;
self
}
}
impl<St, S: BosStr> PlayerSnapshotBuilder<St, S>
where
St: player_snapshot_state::State,
St::Level: player_snapshot_state::IsSet,
St::TotalXp: player_snapshot_state::IsSet,
{
pub fn build(self) -> PlayerSnapshot<S> {
PlayerSnapshot {
items_acquired_today: self._fields.0,
items_consumed_today: self._fields.1,
items_total: self._fields.2,
level: self._fields.3.unwrap(),
specimens_documented: self._fields.4,
total_xp: self._fields.5.unwrap(),
xp_gained_today: self._fields.6,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> PlayerSnapshot<S> {
PlayerSnapshot {
items_acquired_today: self._fields.0,
items_consumed_today: self._fields.1,
items_total: self._fields.2,
level: self._fields.3.unwrap(),
specimens_documented: self._fields.4,
total_xp: self._fields.5.unwrap(),
xp_gained_today: self._fields.6,
extra_data: Some(extra_data),
}
}
}