#[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::yearly;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[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)]
#[serde(
rename_all = "camelCase",
rename = "net.anisota.chronicle.log.yearly",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Yearly<S: BosStr = DefaultStr> {
pub aggregates: yearly::YearlyAggregates<S>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub finalized_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub lower_log_refs: Option<Vec<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub patterns: Option<yearly::YearlyPatterns<S>>,
pub signature: yearly::ChronicleSignature<S>,
pub status: S,
pub year: 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 YearlyGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Yearly<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct YearlyAggregates<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub days_active: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub levels_gained: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub likes_received: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub months_active: 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_received: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub specimens_photographed: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub total_xp_gained: 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 YearlyPatterns<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub avg_blocks_per_day: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub peak_blocks: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub total_active_blocks: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> Yearly<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, YearlyRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
impl<S: BosStr> LexiconSchema for ChronicleSignature<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.yearly"
}
fn def_name() -> &'static str {
"chronicleSignature"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_yearly()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct YearlyRecord;
impl XrpcResp for YearlyRecord {
const NSID: &'static str = "net.anisota.chronicle.log.yearly";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = YearlyGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<YearlyGetRecordOutput<S>> for Yearly<S> {
fn from(output: YearlyGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Yearly<S> {
const NSID: &'static str = "net.anisota.chronicle.log.yearly";
type Record = YearlyRecord;
}
impl Collection for YearlyRecord {
const NSID: &'static str = "net.anisota.chronicle.log.yearly";
type Record = YearlyRecord;
}
impl<S: BosStr> LexiconSchema for Yearly<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.yearly"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_yearly()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for YearlyAggregates<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.yearly"
}
fn def_name() -> &'static str {
"yearlyAggregates"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_yearly()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.days_active {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("days_active"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.levels_gained {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("levels_gained"),
min: 0i64,
actual: *value,
});
}
}
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.months_active {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("months_active"),
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_received {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("replies_received"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.specimens_photographed {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("specimens_photographed"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.total_xp_gained {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("total_xp_gained"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for YearlyPatterns<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.log.yearly"
}
fn def_name() -> &'static str {
"yearlyPatterns"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_log_yearly()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.avg_blocks_per_day {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("avg_blocks_per_day"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.peak_blocks {
if *value > 48i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("peak_blocks"),
max: 48i64,
actual: *value,
});
}
}
if let Some(ref value) = self.peak_blocks {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("peak_blocks"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.total_active_blocks {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("total_active_blocks"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
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),
}
}
}
fn lexicon_doc_net_anisota_chronicle_log_yearly() -> 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.yearly"),
defs: {
let mut map = BTreeMap::new();
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("main"),
LexUserType::Record(LexRecord {
description: Some(
CowStr::new_static(
"Yearly aggregation of monthly records. rkey is YYYY. Updated once per month, finalized when year ends.",
),
),
key: Some(CowStr::new_static("any")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("year"),
SmolStr::new_static("aggregates"),
SmolStr::new_static("status"),
SmolStr::new_static("signature"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("aggregates"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#yearlyAggregates"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"When the yearly record was first created",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("finalizedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"When the yearly record was finalized (end of year)",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lowerLogRefs"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"AT URIs of monthly log records included in this year",
),
),
items: LexArrayItem::String(LexString {
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("patterns"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#yearlyPatterns"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("signature"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#chronicleSignature"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Whether this year is still being updated or has been finalized",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("year"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Year string in YYYY format (e.g. 2026)"),
),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("yearlyAggregates"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Rolled-up counts from monthly records")),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("daysActive"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("levelsGained"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likesReceived"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("monthsActive"),
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("repliesReceived"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("specimensPhotographed"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("totalXPGained"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("yearlyPatterns"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Activity pattern aggregation for the year based on half-hour blocks",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("avgBlocksPerDay"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("peakBlocks"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(48i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("totalActiveBlocks"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod yearly_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 Aggregates;
type CreatedAt;
type Signature;
type Status;
type Year;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Aggregates = Unset;
type CreatedAt = Unset;
type Signature = Unset;
type Status = Unset;
type Year = Unset;
}
pub struct SetAggregates<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAggregates<St> {}
impl<St: State> State for SetAggregates<St> {
type Aggregates = Set<members::aggregates>;
type CreatedAt = St::CreatedAt;
type Signature = St::Signature;
type Status = St::Status;
type Year = St::Year;
}
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 Aggregates = St::Aggregates;
type CreatedAt = Set<members::created_at>;
type Signature = St::Signature;
type Status = St::Status;
type Year = St::Year;
}
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 Aggregates = St::Aggregates;
type CreatedAt = St::CreatedAt;
type Signature = Set<members::signature>;
type Status = St::Status;
type Year = St::Year;
}
pub struct SetStatus<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStatus<St> {}
impl<St: State> State for SetStatus<St> {
type Aggregates = St::Aggregates;
type CreatedAt = St::CreatedAt;
type Signature = St::Signature;
type Status = Set<members::status>;
type Year = St::Year;
}
pub struct SetYear<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetYear<St> {}
impl<St: State> State for SetYear<St> {
type Aggregates = St::Aggregates;
type CreatedAt = St::CreatedAt;
type Signature = St::Signature;
type Status = St::Status;
type Year = Set<members::year>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct aggregates(());
pub struct created_at(());
pub struct signature(());
pub struct status(());
pub struct year(());
}
}
pub struct YearlyBuilder<St: yearly_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<yearly::YearlyAggregates<S>>,
Option<Datetime>,
Option<Datetime>,
Option<Vec<S>>,
Option<yearly::YearlyPatterns<S>>,
Option<yearly::ChronicleSignature<S>>,
Option<S>,
Option<S>,
),
_type: PhantomData<fn() -> S>,
}
impl Yearly<DefaultStr> {
pub fn new() -> YearlyBuilder<yearly_state::Empty, DefaultStr> {
YearlyBuilder::new()
}
}
impl<S: BosStr> Yearly<S> {
pub fn builder() -> YearlyBuilder<yearly_state::Empty, S> {
YearlyBuilder::builder()
}
}
impl YearlyBuilder<yearly_state::Empty, DefaultStr> {
pub fn new() -> Self {
YearlyBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> YearlyBuilder<yearly_state::Empty, S> {
pub fn builder() -> Self {
YearlyBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> YearlyBuilder<St, S>
where
St: yearly_state::State,
St::Aggregates: yearly_state::IsUnset,
{
pub fn aggregates(
mut self,
value: impl Into<yearly::YearlyAggregates<S>>,
) -> YearlyBuilder<yearly_state::SetAggregates<St>, S> {
self._fields.0 = Option::Some(value.into());
YearlyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> YearlyBuilder<St, S>
where
St: yearly_state::State,
St::CreatedAt: yearly_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> YearlyBuilder<yearly_state::SetCreatedAt<St>, S> {
self._fields.1 = Option::Some(value.into());
YearlyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: yearly_state::State, S: BosStr> YearlyBuilder<St, S> {
pub fn finalized_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_finalized_at(mut self, value: Option<Datetime>) -> Self {
self._fields.2 = value;
self
}
}
impl<St: yearly_state::State, S: BosStr> YearlyBuilder<St, S> {
pub fn lower_log_refs(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_lower_log_refs(mut self, value: Option<Vec<S>>) -> Self {
self._fields.3 = value;
self
}
}
impl<St: yearly_state::State, S: BosStr> YearlyBuilder<St, S> {
pub fn patterns(mut self, value: impl Into<Option<yearly::YearlyPatterns<S>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_patterns(mut self, value: Option<yearly::YearlyPatterns<S>>) -> Self {
self._fields.4 = value;
self
}
}
impl<St, S: BosStr> YearlyBuilder<St, S>
where
St: yearly_state::State,
St::Signature: yearly_state::IsUnset,
{
pub fn signature(
mut self,
value: impl Into<yearly::ChronicleSignature<S>>,
) -> YearlyBuilder<yearly_state::SetSignature<St>, S> {
self._fields.5 = Option::Some(value.into());
YearlyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> YearlyBuilder<St, S>
where
St: yearly_state::State,
St::Status: yearly_state::IsUnset,
{
pub fn status(mut self, value: impl Into<S>) -> YearlyBuilder<yearly_state::SetStatus<St>, S> {
self._fields.6 = Option::Some(value.into());
YearlyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> YearlyBuilder<St, S>
where
St: yearly_state::State,
St::Year: yearly_state::IsUnset,
{
pub fn year(mut self, value: impl Into<S>) -> YearlyBuilder<yearly_state::SetYear<St>, S> {
self._fields.7 = Option::Some(value.into());
YearlyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> YearlyBuilder<St, S>
where
St: yearly_state::State,
St::Aggregates: yearly_state::IsSet,
St::CreatedAt: yearly_state::IsSet,
St::Signature: yearly_state::IsSet,
St::Status: yearly_state::IsSet,
St::Year: yearly_state::IsSet,
{
pub fn build(self) -> Yearly<S> {
Yearly {
aggregates: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
finalized_at: self._fields.2,
lower_log_refs: self._fields.3,
patterns: self._fields.4,
signature: self._fields.5.unwrap(),
status: self._fields.6.unwrap(),
year: self._fields.7.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Yearly<S> {
Yearly {
aggregates: self._fields.0.unwrap(),
created_at: self._fields.1.unwrap(),
finalized_at: self._fields.2,
lower_log_refs: self._fields.3,
patterns: self._fields.4,
signature: self._fields.5.unwrap(),
status: self._fields.6.unwrap(),
year: self._fields.7.unwrap(),
extra_data: Some(extra_data),
}
}
}