#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::download_darkworld::deltarune;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LocationElsewhere<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LocationHome<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LocationMathTextbook<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LocationOnSkin<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LocationSchool<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Deltarune<'a> {
pub time: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tool: Option<DeltaruneTool<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub r#where: Option<DeltaruneWhere<'a>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum DeltaruneTool<'a> {
#[serde(rename = "download.darkworld.deltarune#toolPen")]
ToolPen(Box<deltarune::ToolPen<'a>>),
#[serde(rename = "download.darkworld.deltarune#toolPencil")]
ToolPencil(Box<deltarune::ToolPencil<'a>>),
#[serde(rename = "download.darkworld.deltarune#toolMarker")]
ToolMarker(Box<deltarune::ToolMarker<'a>>),
#[serde(rename = "download.darkworld.deltarune#toolFinger")]
ToolFinger(Box<deltarune::ToolFinger<'a>>),
#[serde(rename = "download.darkworld.deltarune#toolOther")]
ToolOther(Box<deltarune::ToolOther<'a>>),
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum DeltaruneWhere<'a> {
#[serde(rename = "download.darkworld.deltarune#locationSchool")]
LocationSchool(Box<deltarune::LocationSchool<'a>>),
#[serde(rename = "download.darkworld.deltarune#locationHome")]
LocationHome(Box<deltarune::LocationHome<'a>>),
#[serde(rename = "download.darkworld.deltarune#locationMathTextbook")]
LocationMathTextbook(Box<deltarune::LocationMathTextbook<'a>>),
#[serde(rename = "download.darkworld.deltarune#locationOnSkin")]
LocationOnSkin(Box<deltarune::LocationOnSkin<'a>>),
#[serde(rename = "download.darkworld.deltarune#locationElsewhere")]
LocationElsewhere(Box<deltarune::LocationElsewhere<'a>>),
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DeltaruneGetRecordOutput<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub cid: Option<Cid<'a>>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(borrow)]
pub value: Deltarune<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ToolFinger<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ToolMarker<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ToolOther<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ToolPen<'a> {}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ToolPencil<'a> {}
impl<'a> Deltarune<'a> {
pub fn uri(
uri: impl Into<CowStr<'a>>,
) -> Result<RecordUri<'a, DeltaruneRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
}
}
impl<'a> LexiconSchema for LocationElsewhere<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"locationElsewhere"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for LocationHome<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"locationHome"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for LocationMathTextbook<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"locationMathTextbook"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for LocationOnSkin<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"locationOnSkin"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for LocationSchool<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"locationSchool"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DeltaruneRecord;
impl XrpcResp for DeltaruneRecord {
const NSID: &'static str = "download.darkworld.deltarune";
const ENCODING: &'static str = "application/json";
type Output<'de> = DeltaruneGetRecordOutput<'de>;
type Err<'de> = RecordError<'de>;
}
impl From<DeltaruneGetRecordOutput<'_>> for Deltarune<'_> {
fn from(output: DeltaruneGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl Collection for Deltarune<'_> {
const NSID: &'static str = "download.darkworld.deltarune";
type Record = DeltaruneRecord;
}
impl Collection for DeltaruneRecord {
const NSID: &'static str = "download.darkworld.deltarune";
type Record = DeltaruneRecord;
}
impl<'a> LexiconSchema for Deltarune<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ToolFinger<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"toolFinger"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ToolMarker<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"toolMarker"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ToolOther<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"toolOther"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ToolPen<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"toolPen"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ToolPencil<'a> {
fn nsid() -> &'static str {
"download.darkworld.deltarune"
}
fn def_name() -> &'static str {
"toolPencil"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_download_darkworld_deltarune()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
fn lexicon_doc_download_darkworld_deltarune() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("download.darkworld.deltarune"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("locationElsewhere"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("locationHome"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("locationMathTextbook"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("locationOnSkin"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("locationSchool"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
description: Some(
CowStr::new_static(
"Describes an instance of the user drawing the Delta Rune symbol from Undertale/Deltarune.",
),
),
key: Some(CowStr::new_static("tid")),
record: LexRecordRecord::Object(LexObject {
required: Some(vec![SmolStr::new_static("time")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("time"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tool"),
LexObjectProperty::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#toolPen"),
CowStr::new_static("#toolPencil"),
CowStr::new_static("#toolMarker"),
CowStr::new_static("#toolFinger"),
CowStr::new_static("#toolOther")
],
..Default::default()
}),
);
map.insert(
SmolStr::new_static("where"),
LexObjectProperty::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#locationSchool"),
CowStr::new_static("#locationHome"),
CowStr::new_static("#locationMathTextbook"),
CowStr::new_static("#locationOnSkin"),
CowStr::new_static("#locationElsewhere")
],
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("toolFinger"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("toolMarker"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("toolOther"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("toolPen"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("toolPencil"),
LexUserType::Object(LexObject {
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod deltarune_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Time;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Time = Unset;
}
pub struct SetTime<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTime<S> {}
impl<S: State> State for SetTime<S> {
type Time = Set<members::time>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct time(());
}
}
pub struct DeltaruneBuilder<'a, S: deltarune_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Datetime>, Option<DeltaruneTool<'a>>, Option<DeltaruneWhere<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Deltarune<'a> {
pub fn new() -> DeltaruneBuilder<'a, deltarune_state::Empty> {
DeltaruneBuilder::new()
}
}
impl<'a> DeltaruneBuilder<'a, deltarune_state::Empty> {
pub fn new() -> Self {
DeltaruneBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> DeltaruneBuilder<'a, S>
where
S: deltarune_state::State,
S::Time: deltarune_state::IsUnset,
{
pub fn time(
mut self,
value: impl Into<Datetime>,
) -> DeltaruneBuilder<'a, deltarune_state::SetTime<S>> {
self._fields.0 = Option::Some(value.into());
DeltaruneBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: deltarune_state::State> DeltaruneBuilder<'a, S> {
pub fn tool(mut self, value: impl Into<Option<DeltaruneTool<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_tool(mut self, value: Option<DeltaruneTool<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S: deltarune_state::State> DeltaruneBuilder<'a, S> {
pub fn r#where(mut self, value: impl Into<Option<DeltaruneWhere<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_where(mut self, value: Option<DeltaruneWhere<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> DeltaruneBuilder<'a, S>
where
S: deltarune_state::State,
S::Time: deltarune_state::IsSet,
{
pub fn build(self) -> Deltarune<'a> {
Deltarune {
time: self._fields.0.unwrap(),
tool: self._fields.1,
r#where: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Deltarune<'a> {
Deltarune {
time: self._fields.0.unwrap(),
tool: self._fields.1,
r#where: self._fields.2,
extra_data: Some(extra_data),
}
}
}