pub mod collection;
pub mod collection_item;
pub mod entry;
pub mod like;
#[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_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::com_atproto::label::SelfLabels;
use crate::org_okazu_diary::embed::external::External;
use crate::org_okazu_diary::embed::record::Record;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Subject<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub labels: Option<SelfLabels<'a>>,
#[serde(borrow)]
pub value: SubjectValue<'a>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum SubjectValue<'a> {
#[serde(rename = "org.okazu-diary.embed.external")]
External(Box<External<'a>>),
#[serde(rename = "org.okazu-diary.embed.record")]
Record(Box<Record<'a>>),
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Tag<'a> {
#[serde(borrow)]
pub value: CowStr<'a>,
}
impl<'a> LexiconSchema for Subject<'a> {
fn nsid() -> &'static str {
"org.okazu-diary.feed.defs"
}
fn def_name() -> &'static str {
"subject"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_org_okazu_diary_feed_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for Tag<'a> {
fn nsid() -> &'static str {
"org.okazu-diary.feed.defs"
}
fn def_name() -> &'static str {
"tag"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_org_okazu_diary_feed_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.value;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("value"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.value;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) < 1usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("value"),
min: 1usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
pub mod subject_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 Value;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Value = Unset;
}
pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetValue<S> {}
impl<S: State> State for SetValue<S> {
type Value = Set<members::value>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct value(());
}
}
pub struct SubjectBuilder<'a, S: subject_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<SelfLabels<'a>>, Option<SubjectValue<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Subject<'a> {
pub fn new() -> SubjectBuilder<'a, subject_state::Empty> {
SubjectBuilder::new()
}
}
impl<'a> SubjectBuilder<'a, subject_state::Empty> {
pub fn new() -> Self {
SubjectBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: subject_state::State> SubjectBuilder<'a, S> {
pub fn labels(mut self, value: impl Into<Option<SelfLabels<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_labels(mut self, value: Option<SelfLabels<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S> SubjectBuilder<'a, S>
where
S: subject_state::State,
S::Value: subject_state::IsUnset,
{
pub fn value(
mut self,
value: impl Into<SubjectValue<'a>>,
) -> SubjectBuilder<'a, subject_state::SetValue<S>> {
self._fields.1 = Option::Some(value.into());
SubjectBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SubjectBuilder<'a, S>
where
S: subject_state::State,
S::Value: subject_state::IsSet,
{
pub fn build(self) -> Subject<'a> {
Subject {
labels: self._fields.0,
value: self._fields.1.unwrap(),
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>,
>,
) -> Subject<'a> {
Subject {
labels: self._fields.0,
value: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_org_okazu_diary_feed_defs() -> 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("org.okazu-diary.feed.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("subject"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A descriptor of a material used to help self-gratification.",
),
),
required: Some(vec![SmolStr::new_static("value")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("labels"),
LexObjectProperty::Union(LexRefUnion {
description: Some(
CowStr::new_static(
"User-specified self-label values for the material. The Lexicon by its nature assumes the material to be possibly sensitive by default, so the explicit label values are intended to signal that a warning should be put on the material even for the Okazu-Diary.org application users who are willing to see mature contents in general.",
),
),
refs: vec![
CowStr::new_static("com.atproto.label.defs#selfLabels")
],
..Default::default()
}),
);
map.insert(
SmolStr::new_static("value"),
LexObjectProperty::Union(LexRefUnion {
refs: vec![
CowStr::new_static("org.okazu-diary.embed.external"),
CowStr::new_static("org.okazu-diary.embed.record")
],
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tag"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("value")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("value"),
LexObjectProperty::String(LexString {
min_length: Some(1usize),
max_length: Some(256usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}