pub mod camp;
#[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::expedition;
#[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, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ExpeditionConditions<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub biome: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub light_level: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub moon_phase: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub user_state: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub weather: Option<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, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ExpeditionFindings<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub items_collected: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub likes_sent: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub moths_seen: 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 specimens_found: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub 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 ExpeditionHeartbeat<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub light: Option<expedition::HeartbeatLight<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub progress: Option<expedition::HeartbeatProgress<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
#[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 ExpeditionLight<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub at_end: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub at_start: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub consumed: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub drain_rate: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub regenerated: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<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, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct HeartbeatLight<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub current: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub drain_active: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub drain_rate: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub frozen: Option<bool>,
#[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 HeartbeatProgress<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub items_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub likes_sent: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub moths_seen_count: 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 reposts_sent: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub specimens_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub 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)]
#[serde(
rename_all = "camelCase",
rename = "net.anisota.chronicle.expedition",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Expedition<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub abandon_reason: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub active_duration: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub camps_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub completed_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub conditions: Option<expedition::ExpeditionConditions<S>>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub expedition_number: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub findings: Option<expedition::ExpeditionFindings<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub heartbeat: Option<expedition::ExpeditionHeartbeat<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub light: Option<expedition::ExpeditionLight<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub rest_duration: Option<i64>,
pub signature: expedition::ChronicleSignature<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub started_at: Option<Datetime>,
pub status: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
#[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 ExpeditionGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Expedition<S>,
}
impl<S: BosStr> Expedition<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, ExpeditionRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
impl<S: BosStr> LexiconSchema for ChronicleSignature<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.expedition"
}
fn def_name() -> &'static str {
"chronicleSignature"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_expedition()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ExpeditionConditions<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.expedition"
}
fn def_name() -> &'static str {
"expeditionConditions"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_expedition()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ExpeditionFindings<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.expedition"
}
fn def_name() -> &'static str {
"expeditionFindings"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_expedition()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.items_collected {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("items_collected"),
min: 0i64,
actual: *value,
});
}
}
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.moths_seen {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("moths_seen"),
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.specimens_found {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("specimens_found"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.xp_gained {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("xp_gained"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ExpeditionHeartbeat<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.expedition"
}
fn def_name() -> &'static str {
"expeditionHeartbeat"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_expedition()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ExpeditionLight<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.expedition"
}
fn def_name() -> &'static str {
"expeditionLight"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_expedition()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.at_end {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("at_end"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.at_start {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("at_start"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.consumed {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("consumed"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.regenerated {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("regenerated"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for HeartbeatLight<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.expedition"
}
fn def_name() -> &'static str {
"heartbeatLight"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_expedition()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for HeartbeatProgress<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.expedition"
}
fn def_name() -> &'static str {
"heartbeatProgress"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_expedition()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.items_count {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("items_count"),
min: 0i64,
actual: *value,
});
}
}
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.moths_seen_count {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("moths_seen_count"),
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.reposts_sent {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("reposts_sent"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.specimens_count {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("specimens_count"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.xp_gained {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("xp_gained"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ExpeditionRecord;
impl XrpcResp for ExpeditionRecord {
const NSID: &'static str = "net.anisota.chronicle.expedition";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = ExpeditionGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<ExpeditionGetRecordOutput<S>> for Expedition<S> {
fn from(output: ExpeditionGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Expedition<S> {
const NSID: &'static str = "net.anisota.chronicle.expedition";
type Record = ExpeditionRecord;
}
impl Collection for ExpeditionRecord {
const NSID: &'static str = "net.anisota.chronicle.expedition";
type Record = ExpeditionRecord;
}
impl<S: BosStr> LexiconSchema for Expedition<S> {
fn nsid() -> &'static str {
"net.anisota.chronicle.expedition"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_net_anisota_chronicle_expedition()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.active_duration {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("active_duration"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.camps_count {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("camps_count"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.duration {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("duration"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.expedition_number {
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("expedition_number"),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.rest_duration {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("rest_duration"),
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_expedition() -> 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.expedition"),
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("expeditionConditions"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Environmental conditions during expedition",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("biome"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Forest biome type")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lightLevel"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Time-of-day light condition at expedition start",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("moonPhase"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Moon phase condition (nighttime only)",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("userState"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"User fatigue state at expedition start",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("weather"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Weather condition during expedition",
)),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("expeditionFindings"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"What was found/gathered during the expedition",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("itemsCollected"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likesSent"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("mothsSeen"),
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("specimensFound"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("xpGained"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("expeditionHeartbeat"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Periodic snapshot of expedition progress for cross-device sync",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("light"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#heartbeatLight"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("progress"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#heartbeatProgress"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"When this heartbeat was written",
)),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("expeditionLight"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Light resource tracking for the expedition",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("atEnd"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("atStart"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("consumed"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("drainRate"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("regenerated"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Light status at start of expedition",
)),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("heartbeatLight"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Light state at heartbeat time")),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("current"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("drainActive"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("drainRate"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("frozen"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("heartbeatProgress"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Session progress counters at heartbeat time",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("itemsCount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("likesSent"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("mothsSeenCount"),
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("repostsSent"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("specimensCount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("xpGained"),
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(
"Expedition record. Created with status 'active' when entering the forest, updated to 'completed'/'abandoned' on extraction/abandon. rkey is a TID. Tracks the full lifecycle of a forest expedition including camps, gathered loot, light consumption, and conditions.",
),
),
key: Some(CowStr::new_static("tid")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
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("abandonReason"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Reason for abandonment (only set if status is 'abandoned')",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("activeDuration"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("campsCount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("completedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"When the expedition ended (extracted or abandoned)",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("conditions"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#expeditionConditions"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When the record was created"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("duration"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("expeditionNumber"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("findings"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#expeditionFindings"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("heartbeat"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#expeditionHeartbeat"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("light"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#expeditionLight"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("restDuration"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("signature"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#chronicleSignature"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("startedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"When the expedition started (entered forest)",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Current expedition status"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When the record was last updated"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod expedition_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 CreatedAt;
type Signature;
type Status;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Signature = Unset;
type Status = Unset;
}
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 CreatedAt = Set<members::created_at>;
type Signature = St::Signature;
type Status = St::Status;
}
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 CreatedAt = St::CreatedAt;
type Signature = Set<members::signature>;
type Status = St::Status;
}
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 CreatedAt = St::CreatedAt;
type Signature = St::Signature;
type Status = Set<members::status>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct signature(());
pub struct status(());
}
}
pub struct ExpeditionBuilder<St: expedition_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<S>,
Option<i64>,
Option<i64>,
Option<Datetime>,
Option<expedition::ExpeditionConditions<S>>,
Option<Datetime>,
Option<i64>,
Option<i64>,
Option<expedition::ExpeditionFindings<S>>,
Option<expedition::ExpeditionHeartbeat<S>>,
Option<expedition::ExpeditionLight<S>>,
Option<i64>,
Option<expedition::ChronicleSignature<S>>,
Option<Datetime>,
Option<S>,
Option<Datetime>,
),
_type: PhantomData<fn() -> S>,
}
impl Expedition<DefaultStr> {
pub fn new() -> ExpeditionBuilder<expedition_state::Empty, DefaultStr> {
ExpeditionBuilder::new()
}
}
impl<S: BosStr> Expedition<S> {
pub fn builder() -> ExpeditionBuilder<expedition_state::Empty, S> {
ExpeditionBuilder::builder()
}
}
impl ExpeditionBuilder<expedition_state::Empty, DefaultStr> {
pub fn new() -> Self {
ExpeditionBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr> ExpeditionBuilder<expedition_state::Empty, S> {
pub fn builder() -> Self {
ExpeditionBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None,
),
_type: PhantomData,
}
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn abandon_reason(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_abandon_reason(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn active_duration(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_active_duration(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn camps_count(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_camps_count(mut self, value: Option<i64>) -> Self {
self._fields.2 = value;
self
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn completed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_completed_at(mut self, value: Option<Datetime>) -> Self {
self._fields.3 = value;
self
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn conditions(
mut self,
value: impl Into<Option<expedition::ExpeditionConditions<S>>>,
) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_conditions(mut self, value: Option<expedition::ExpeditionConditions<S>>) -> Self {
self._fields.4 = value;
self
}
}
impl<St, S: BosStr> ExpeditionBuilder<St, S>
where
St: expedition_state::State,
St::CreatedAt: expedition_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> ExpeditionBuilder<expedition_state::SetCreatedAt<St>, S> {
self._fields.5 = Option::Some(value.into());
ExpeditionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn duration(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_duration(mut self, value: Option<i64>) -> Self {
self._fields.6 = value;
self
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn expedition_number(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_expedition_number(mut self, value: Option<i64>) -> Self {
self._fields.7 = value;
self
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn findings(mut self, value: impl Into<Option<expedition::ExpeditionFindings<S>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_findings(mut self, value: Option<expedition::ExpeditionFindings<S>>) -> Self {
self._fields.8 = value;
self
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn heartbeat(
mut self,
value: impl Into<Option<expedition::ExpeditionHeartbeat<S>>>,
) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_heartbeat(mut self, value: Option<expedition::ExpeditionHeartbeat<S>>) -> Self {
self._fields.9 = value;
self
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn light(mut self, value: impl Into<Option<expedition::ExpeditionLight<S>>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_light(mut self, value: Option<expedition::ExpeditionLight<S>>) -> Self {
self._fields.10 = value;
self
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn rest_duration(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_rest_duration(mut self, value: Option<i64>) -> Self {
self._fields.11 = value;
self
}
}
impl<St, S: BosStr> ExpeditionBuilder<St, S>
where
St: expedition_state::State,
St::Signature: expedition_state::IsUnset,
{
pub fn signature(
mut self,
value: impl Into<expedition::ChronicleSignature<S>>,
) -> ExpeditionBuilder<expedition_state::SetSignature<St>, S> {
self._fields.12 = Option::Some(value.into());
ExpeditionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn started_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_started_at(mut self, value: Option<Datetime>) -> Self {
self._fields.13 = value;
self
}
}
impl<St, S: BosStr> ExpeditionBuilder<St, S>
where
St: expedition_state::State,
St::Status: expedition_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<S>,
) -> ExpeditionBuilder<expedition_state::SetStatus<St>, S> {
self._fields.14 = Option::Some(value.into());
ExpeditionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: expedition_state::State, S: BosStr> ExpeditionBuilder<St, S> {
pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.15 = value.into();
self
}
pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
self._fields.15 = value;
self
}
}
impl<St, S: BosStr> ExpeditionBuilder<St, S>
where
St: expedition_state::State,
St::CreatedAt: expedition_state::IsSet,
St::Signature: expedition_state::IsSet,
St::Status: expedition_state::IsSet,
{
pub fn build(self) -> Expedition<S> {
Expedition {
abandon_reason: self._fields.0,
active_duration: self._fields.1,
camps_count: self._fields.2,
completed_at: self._fields.3,
conditions: self._fields.4,
created_at: self._fields.5.unwrap(),
duration: self._fields.6,
expedition_number: self._fields.7,
findings: self._fields.8,
heartbeat: self._fields.9,
light: self._fields.10,
rest_duration: self._fields.11,
signature: self._fields.12.unwrap(),
started_at: self._fields.13,
status: self._fields.14.unwrap(),
updated_at: self._fields.15,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Expedition<S> {
Expedition {
abandon_reason: self._fields.0,
active_duration: self._fields.1,
camps_count: self._fields.2,
completed_at: self._fields.3,
conditions: self._fields.4,
created_at: self._fields.5.unwrap(),
duration: self._fields.6,
expedition_number: self._fields.7,
findings: self._fields.8,
heartbeat: self._fields.9,
light: self._fields.10,
rest_duration: self._fields.11,
signature: self._fields.12.unwrap(),
started_at: self._fields.13,
status: self._fields.14.unwrap(),
updated_at: self._fields.15,
extra_data: Some(extra_data),
}
}
}