#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Ingredient<'a> {
pub grams: i64,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub group: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub id: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(default = "_default_ingredient_is_detached")]
pub is_detached: std::option::Option<bool>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(default = "_default_ingredient_is_optional")]
pub is_optional: std::option::Option<bool>,
#[serde(borrow)]
pub name: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub notes: std::option::Option<jacquard_common::CowStr<'a>>,
}
fn _default_ingredient_is_detached() -> std::option::Option<bool> {
Some(false)
}
fn _default_ingredient_is_optional() -> std::option::Option<bool> {
Some(false)
}
pub mod ingredient_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 Grams;
type Name;
type Id;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Grams = Unset;
type Name = Unset;
type Id = Unset;
}
pub struct SetGrams<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetGrams<S> {}
impl<S: State> State for SetGrams<S> {
type Grams = Set<members::grams>;
type Name = S::Name;
type Id = S::Id;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Grams = S::Grams;
type Name = Set<members::name>;
type Id = S::Id;
}
pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetId<S> {}
impl<S: State> State for SetId<S> {
type Grams = S::Grams;
type Name = S::Name;
type Id = Set<members::id>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct grams(());
pub struct name(());
pub struct id(());
}
}
pub struct IngredientBuilder<'a, S: ingredient_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<i64>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<bool>,
::core::option::Option<bool>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Ingredient<'a> {
pub fn new() -> IngredientBuilder<'a, ingredient_state::Empty> {
IngredientBuilder::new()
}
}
impl<'a> IngredientBuilder<'a, ingredient_state::Empty> {
pub fn new() -> Self {
IngredientBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> IngredientBuilder<'a, S>
where
S: ingredient_state::State,
S::Grams: ingredient_state::IsUnset,
{
pub fn grams(
mut self,
value: impl Into<i64>,
) -> IngredientBuilder<'a, ingredient_state::SetGrams<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
IngredientBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: ingredient_state::State> IngredientBuilder<'a, S> {
pub fn group(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_group(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> IngredientBuilder<'a, S>
where
S: ingredient_state::State,
S::Id: ingredient_state::IsUnset,
{
pub fn id(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> IngredientBuilder<'a, ingredient_state::SetId<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
IngredientBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: ingredient_state::State> IngredientBuilder<'a, S> {
pub fn is_detached(mut self, value: impl Into<Option<bool>>) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_is_detached(mut self, value: Option<bool>) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S: ingredient_state::State> IngredientBuilder<'a, S> {
pub fn is_optional(mut self, value: impl Into<Option<bool>>) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_is_optional(mut self, value: Option<bool>) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S> IngredientBuilder<'a, S>
where
S: ingredient_state::State,
S::Name: ingredient_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> IngredientBuilder<'a, ingredient_state::SetName<S>> {
self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
IngredientBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: ingredient_state::State> IngredientBuilder<'a, S> {
pub fn notes(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.6 = value.into();
self
}
pub fn maybe_notes(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.6 = value;
self
}
}
impl<'a, S> IngredientBuilder<'a, S>
where
S: ingredient_state::State,
S::Grams: ingredient_state::IsSet,
S::Name: ingredient_state::IsSet,
S::Id: ingredient_state::IsSet,
{
pub fn build(self) -> Ingredient<'a> {
Ingredient {
grams: self.__unsafe_private_named.0.unwrap(),
group: self.__unsafe_private_named.1,
id: self.__unsafe_private_named.2.unwrap(),
is_detached: self.__unsafe_private_named.3.or_else(|| Some(false)),
is_optional: self.__unsafe_private_named.4.or_else(|| Some(false)),
name: self.__unsafe_private_named.5.unwrap(),
notes: self.__unsafe_private_named.6,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Ingredient<'a> {
Ingredient {
grams: self.__unsafe_private_named.0.unwrap(),
group: self.__unsafe_private_named.1,
id: self.__unsafe_private_named.2.unwrap(),
is_detached: self.__unsafe_private_named.3.or_else(|| Some(false)),
is_optional: self.__unsafe_private_named.4.or_else(|| Some(false)),
name: self.__unsafe_private_named.5.unwrap(),
notes: self.__unsafe_private_named.6,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_io_kich_recipe_recipe() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("io.kich.recipe.recipe"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("ingredient"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("id"),
::jacquard_common::deps::smol_str::SmolStr::new_static("name"),
::jacquard_common::deps::smol_str::SmolStr::new_static("grams")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"grams",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"group",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Optional group name for organizing ingredients (e.g., 'For the sauce:', 'For the pasta:')",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("id"),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Unique identifier for this ingredient",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"isDetached",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"isOptional",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"name",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Ingredient name"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"notes",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Optional notes about this ingredient (e.g., original quantity)",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"instructionStep",
),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("id"),
::jacquard_common::deps::smol_str::SmolStr::new_static("value")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("id"),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Unique identifier for this instruction step",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"value",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Instruction text"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
description: None,
key: Some(::jacquard_common::CowStr::new_static("tid")),
record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("name"),
::jacquard_common::deps::smol_str::SmolStr::new_static("servings"),
::jacquard_common::deps::smol_str::SmolStr::new_static("createdAt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"cookTimeMinutes",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"When this recipe was created",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdBy",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"description",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Recipe description"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"imageUrl",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Image URL for the recipe",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Uri,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"ingredients",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static("Recipe ingredients"),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#ingredient"),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"instructions",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Cooking instructions as an array of steps",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"#instructionStep",
),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"isPrivate",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
description: None,
default: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"name",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static("Recipe name"),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"prepTimeMinutes",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"servings",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"source",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Source name (book, magazine, blog)",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"updatedAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"When this recipe was last updated",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"url",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Source URL of the recipe",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Uri,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Ingredient<'a> {
fn nsid() -> &'static str {
"io.kich.recipe.recipe"
}
fn def_name() -> &'static str {
"ingredient"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_io_kich_recipe_recipe()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic,
Default
)]
#[serde(rename_all = "camelCase")]
pub struct InstructionStep<'a> {
#[serde(borrow)]
pub id: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub value: jacquard_common::CowStr<'a>,
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for InstructionStep<'a> {
fn nsid() -> &'static str {
"io.kich.recipe.recipe"
}
fn def_name() -> &'static str {
"instructionStep"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_io_kich_recipe_recipe()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Recipe<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub cook_time_minutes: std::option::Option<i64>,
pub created_at: jacquard_common::types::string::Datetime,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub created_by: std::option::Option<
crate::com_atproto::repo::strong_ref::StrongRef<'a>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub description: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub image_url: std::option::Option<jacquard_common::types::string::UriValue<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub ingredients: std::option::Option<
Vec<crate::io_kich::recipe::recipe::Ingredient<'a>>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub instructions: std::option::Option<
Vec<crate::io_kich::recipe::recipe::InstructionStep<'a>>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(default = "_default_recipe_is_private")]
pub is_private: std::option::Option<bool>,
#[serde(borrow)]
pub name: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub prep_time_minutes: std::option::Option<i64>,
#[serde(default = "_default_recipe_servings")]
pub servings: i64,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub source: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub updated_at: std::option::Option<jacquard_common::types::string::Datetime>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub url: std::option::Option<jacquard_common::types::string::UriValue<'a>>,
}
fn _default_recipe_is_private() -> std::option::Option<bool> {
Some(false)
}
fn _default_recipe_servings() -> i64 {
1i64
}
pub mod recipe_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 Servings;
type CreatedAt;
type Name;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Servings = Unset;
type CreatedAt = Unset;
type Name = Unset;
}
pub struct SetServings<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetServings<S> {}
impl<S: State> State for SetServings<S> {
type Servings = Set<members::servings>;
type CreatedAt = S::CreatedAt;
type Name = S::Name;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Servings = S::Servings;
type CreatedAt = Set<members::created_at>;
type Name = S::Name;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Servings = S::Servings;
type CreatedAt = S::CreatedAt;
type Name = Set<members::name>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct servings(());
pub struct created_at(());
pub struct name(());
}
}
pub struct RecipeBuilder<'a, S: recipe_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<i64>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::UriValue<'a>>,
::core::option::Option<Vec<crate::io_kich::recipe::recipe::Ingredient<'a>>>,
::core::option::Option<Vec<crate::io_kich::recipe::recipe::InstructionStep<'a>>>,
::core::option::Option<bool>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<i64>,
::core::option::Option<i64>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::types::string::UriValue<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Recipe<'a> {
pub fn new() -> RecipeBuilder<'a, recipe_state::Empty> {
RecipeBuilder::new()
}
}
impl<'a> RecipeBuilder<'a, recipe_state::Empty> {
pub fn new() -> Self {
RecipeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn cook_time_minutes(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_cook_time_minutes(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> RecipeBuilder<'a, S>
where
S: recipe_state::State,
S::CreatedAt: recipe_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> RecipeBuilder<'a, recipe_state::SetCreatedAt<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
RecipeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn created_by(
mut self,
value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_created_by(
mut self,
value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn description(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_description(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn image_url(
mut self,
value: impl Into<Option<jacquard_common::types::string::UriValue<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_image_url(
mut self,
value: Option<jacquard_common::types::string::UriValue<'a>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn ingredients(
mut self,
value: impl Into<Option<Vec<crate::io_kich::recipe::recipe::Ingredient<'a>>>>,
) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_ingredients(
mut self,
value: Option<Vec<crate::io_kich::recipe::recipe::Ingredient<'a>>>,
) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn instructions(
mut self,
value: impl Into<
Option<Vec<crate::io_kich::recipe::recipe::InstructionStep<'a>>>,
>,
) -> Self {
self.__unsafe_private_named.6 = value.into();
self
}
pub fn maybe_instructions(
mut self,
value: Option<Vec<crate::io_kich::recipe::recipe::InstructionStep<'a>>>,
) -> Self {
self.__unsafe_private_named.6 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn is_private(mut self, value: impl Into<Option<bool>>) -> Self {
self.__unsafe_private_named.7 = value.into();
self
}
pub fn maybe_is_private(mut self, value: Option<bool>) -> Self {
self.__unsafe_private_named.7 = value;
self
}
}
impl<'a, S> RecipeBuilder<'a, S>
where
S: recipe_state::State,
S::Name: recipe_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> RecipeBuilder<'a, recipe_state::SetName<S>> {
self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
RecipeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn prep_time_minutes(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.9 = value.into();
self
}
pub fn maybe_prep_time_minutes(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.9 = value;
self
}
}
impl<'a, S> RecipeBuilder<'a, S>
where
S: recipe_state::State,
S::Servings: recipe_state::IsUnset,
{
pub fn servings(
mut self,
value: impl Into<i64>,
) -> RecipeBuilder<'a, recipe_state::SetServings<S>> {
self.__unsafe_private_named.10 = ::core::option::Option::Some(value.into());
RecipeBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn source(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.11 = value.into();
self
}
pub fn maybe_source(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.11 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn updated_at(
mut self,
value: impl Into<Option<jacquard_common::types::string::Datetime>>,
) -> Self {
self.__unsafe_private_named.12 = value.into();
self
}
pub fn maybe_updated_at(
mut self,
value: Option<jacquard_common::types::string::Datetime>,
) -> Self {
self.__unsafe_private_named.12 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn url(
mut self,
value: impl Into<Option<jacquard_common::types::string::UriValue<'a>>>,
) -> Self {
self.__unsafe_private_named.13 = value.into();
self
}
pub fn maybe_url(
mut self,
value: Option<jacquard_common::types::string::UriValue<'a>>,
) -> Self {
self.__unsafe_private_named.13 = value;
self
}
}
impl<'a, S> RecipeBuilder<'a, S>
where
S: recipe_state::State,
S::Servings: recipe_state::IsSet,
S::CreatedAt: recipe_state::IsSet,
S::Name: recipe_state::IsSet,
{
pub fn build(self) -> Recipe<'a> {
Recipe {
cook_time_minutes: self.__unsafe_private_named.0,
created_at: self.__unsafe_private_named.1.unwrap(),
created_by: self.__unsafe_private_named.2,
description: self.__unsafe_private_named.3,
image_url: self.__unsafe_private_named.4,
ingredients: self.__unsafe_private_named.5,
instructions: self.__unsafe_private_named.6,
is_private: self.__unsafe_private_named.7.or_else(|| Some(false)),
name: self.__unsafe_private_named.8.unwrap(),
prep_time_minutes: self.__unsafe_private_named.9,
servings: self.__unsafe_private_named.10.unwrap(),
source: self.__unsafe_private_named.11,
updated_at: self.__unsafe_private_named.12,
url: self.__unsafe_private_named.13,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Recipe<'a> {
Recipe {
cook_time_minutes: self.__unsafe_private_named.0,
created_at: self.__unsafe_private_named.1.unwrap(),
created_by: self.__unsafe_private_named.2,
description: self.__unsafe_private_named.3,
image_url: self.__unsafe_private_named.4,
ingredients: self.__unsafe_private_named.5,
instructions: self.__unsafe_private_named.6,
is_private: self.__unsafe_private_named.7.or_else(|| Some(false)),
name: self.__unsafe_private_named.8.unwrap(),
prep_time_minutes: self.__unsafe_private_named.9,
servings: self.__unsafe_private_named.10.unwrap(),
source: self.__unsafe_private_named.11,
updated_at: self.__unsafe_private_named.12,
url: self.__unsafe_private_named.13,
extra_data: Some(extra_data),
}
}
}
impl<'a> Recipe<'a> {
pub fn uri(
uri: impl Into<jacquard_common::CowStr<'a>>,
) -> Result<
jacquard_common::types::uri::RecordUri<'a, RecipeRecord>,
jacquard_common::types::uri::UriError,
> {
jacquard_common::types::uri::RecordUri::try_from_uri(
jacquard_common::types::string::AtUri::new_cow(uri.into())?,
)
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct RecipeGetRecordOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
#[serde(borrow)]
pub uri: jacquard_common::types::string::AtUri<'a>,
#[serde(borrow)]
pub value: Recipe<'a>,
}
impl From<RecipeGetRecordOutput<'_>> for Recipe<'_> {
fn from(output: RecipeGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl jacquard_common::types::collection::Collection for Recipe<'_> {
const NSID: &'static str = "io.kich.recipe.recipe";
type Record = RecipeRecord;
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct RecipeRecord;
impl jacquard_common::xrpc::XrpcResp for RecipeRecord {
const NSID: &'static str = "io.kich.recipe.recipe";
const ENCODING: &'static str = "application/json";
type Output<'de> = RecipeGetRecordOutput<'de>;
type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}
impl jacquard_common::types::collection::Collection for RecipeRecord {
const NSID: &'static str = "io.kich.recipe.recipe";
type Record = RecipeRecord;
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Recipe<'a> {
fn nsid() -> &'static str {
"io.kich.recipe.recipe"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_io_kich_recipe_recipe()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}