#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, 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, 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;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LocationElsewhere<S: BosStr = DefaultStr> {
#[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 LocationHome<S: BosStr = DefaultStr> {
#[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 LocationMathTextbook<S: BosStr = DefaultStr> {
#[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 LocationOnSkin<S: BosStr = DefaultStr> {
#[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 LocationSchool<S: BosStr = DefaultStr> {
#[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 = "download.darkworld.deltarune",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Deltarune<S: BosStr = DefaultStr> {
pub time: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub tool: Option<DeltaruneTool<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub r#where: Option<DeltaruneWhere<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum DeltaruneTool<S: BosStr = DefaultStr> {
#[serde(rename = "download.darkworld.deltarune#toolPen")]
ToolPen(Box<deltarune::ToolPen<S>>),
#[serde(rename = "download.darkworld.deltarune#toolPencil")]
ToolPencil(Box<deltarune::ToolPencil<S>>),
#[serde(rename = "download.darkworld.deltarune#toolMarker")]
ToolMarker(Box<deltarune::ToolMarker<S>>),
#[serde(rename = "download.darkworld.deltarune#toolFinger")]
ToolFinger(Box<deltarune::ToolFinger<S>>),
#[serde(rename = "download.darkworld.deltarune#toolOther")]
ToolOther(Box<deltarune::ToolOther<S>>),
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum DeltaruneWhere<S: BosStr = DefaultStr> {
#[serde(rename = "download.darkworld.deltarune#locationSchool")]
LocationSchool(Box<deltarune::LocationSchool<S>>),
#[serde(rename = "download.darkworld.deltarune#locationHome")]
LocationHome(Box<deltarune::LocationHome<S>>),
#[serde(rename = "download.darkworld.deltarune#locationMathTextbook")]
LocationMathTextbook(Box<deltarune::LocationMathTextbook<S>>),
#[serde(rename = "download.darkworld.deltarune#locationOnSkin")]
LocationOnSkin(Box<deltarune::LocationOnSkin<S>>),
#[serde(rename = "download.darkworld.deltarune#locationElsewhere")]
LocationElsewhere(Box<deltarune::LocationElsewhere<S>>),
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DeltaruneGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Deltarune<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ToolFinger<S: BosStr = DefaultStr> {
#[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 ToolMarker<S: BosStr = DefaultStr> {
#[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 ToolOther<S: BosStr = DefaultStr> {
#[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 ToolPen<S: BosStr = DefaultStr> {
#[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 ToolPencil<S: BosStr = DefaultStr> {
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> Deltarune<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, DeltaruneRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
impl<S: BosStr> LexiconSchema for LocationElsewhere<S> {
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<S: BosStr> LexiconSchema for LocationHome<S> {
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<S: BosStr> LexiconSchema for LocationMathTextbook<S> {
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<S: BosStr> LexiconSchema for LocationOnSkin<S> {
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<S: BosStr> LexiconSchema for LocationSchool<S> {
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<S: BosStr> = DeltaruneGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<DeltaruneGetRecordOutput<S>> for Deltarune<S> {
fn from(output: DeltaruneGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Deltarune<S> {
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<S: BosStr> LexiconSchema for Deltarune<S> {
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<S: BosStr> LexiconSchema for ToolFinger<S> {
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<S: BosStr> LexiconSchema for ToolMarker<S> {
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<S: BosStr> LexiconSchema for ToolOther<S> {
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<S: BosStr> LexiconSchema for ToolPen<S> {
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<S: BosStr> LexiconSchema for ToolPencil<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTime<St> {}
impl<St: State> State for SetTime<St> {
type Time = Set<members::time>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct time(());
}
}
pub struct DeltaruneBuilder<S: BosStr, St: deltarune_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Datetime>, Option<DeltaruneTool<S>>, Option<DeltaruneWhere<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Deltarune<S> {
pub fn new() -> DeltaruneBuilder<S, deltarune_state::Empty> {
DeltaruneBuilder::new()
}
}
impl<S: BosStr> DeltaruneBuilder<S, deltarune_state::Empty> {
pub fn new() -> Self {
DeltaruneBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> DeltaruneBuilder<S, St>
where
St: deltarune_state::State,
St::Time: deltarune_state::IsUnset,
{
pub fn time(
mut self,
value: impl Into<Datetime>,
) -> DeltaruneBuilder<S, deltarune_state::SetTime<St>> {
self._fields.0 = Option::Some(value.into());
DeltaruneBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: deltarune_state::State> DeltaruneBuilder<S, St> {
pub fn tool(mut self, value: impl Into<Option<DeltaruneTool<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_tool(mut self, value: Option<DeltaruneTool<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: deltarune_state::State> DeltaruneBuilder<S, St> {
pub fn r#where(mut self, value: impl Into<Option<DeltaruneWhere<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_where(mut self, value: Option<DeltaruneWhere<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> DeltaruneBuilder<S, St>
where
St: deltarune_state::State,
St::Time: deltarune_state::IsSet,
{
pub fn build(self) -> Deltarune<S> {
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<SmolStr, Data<S>>,
) -> Deltarune<S> {
Deltarune {
time: self._fields.0.unwrap(),
tool: self._fields.1,
r#where: self._fields.2,
extra_data: Some(extra_data),
}
}
}