#[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::blob::BlobRef;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
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::com_atproto::repo::strong_ref::StrongRef;
use crate::io_kich::recipe::recipe;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Ingredient<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub grams: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub group: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub heuristic_amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub heuristic_unit: Option<S>,
pub id: S,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_ingredient_is_detached")]
pub is_detached: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_ingredient_is_optional")]
pub is_optional: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub measured_amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub measured_unit: Option<S>,
pub name: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub notes: 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 InstructionStep<S: BosStr = DefaultStr> {
pub id: S,
pub value: 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)]
#[serde(
rename_all = "camelCase",
rename = "io.kich.recipe.recipe",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Recipe<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cook_time_minutes: Option<i64>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub created_by: Option<StrongRef<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub embedding: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_url: Option<UriValue<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub images: Option<Vec<BlobRef<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ingredients: Option<Vec<recipe::Ingredient<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub instructions: Option<Vec<recipe::InstructionStep<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_recipe_is_private")]
pub is_private: Option<bool>,
pub name: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub prep_time_minutes: Option<i64>,
#[serde(default = "_default_recipe_servings")]
pub servings: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<recipe::Tag<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<UriValue<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub variation_of: Option<StrongRef<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)]
#[serde(rename_all = "camelCase")]
pub struct RecipeGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Recipe<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Tag<S: BosStr = DefaultStr> {
pub id: S,
pub name: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> Recipe<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, RecipeRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
impl<S: BosStr> LexiconSchema for Ingredient<S> {
fn nsid() -> &'static str {
"io.kich.recipe.recipe"
}
fn def_name() -> &'static str {
"ingredient"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_io_kich_recipe_recipe()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for InstructionStep<S> {
fn nsid() -> &'static str {
"io.kich.recipe.recipe"
}
fn def_name() -> &'static str {
"instructionStep"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_io_kich_recipe_recipe()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RecipeRecord;
impl XrpcResp for RecipeRecord {
const NSID: &'static str = "io.kich.recipe.recipe";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = RecipeGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<RecipeGetRecordOutput<S>> for Recipe<S> {
fn from(output: RecipeGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Recipe<S> {
const NSID: &'static str = "io.kich.recipe.recipe";
type Record = RecipeRecord;
}
impl Collection for RecipeRecord {
const NSID: &'static str = "io.kich.recipe.recipe";
type Record = RecipeRecord;
}
impl<S: BosStr> LexiconSchema for Recipe<S> {
fn nsid() -> &'static str {
"io.kich.recipe.recipe"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_io_kich_recipe_recipe()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.images {
#[allow(unused_comparisons)]
if value.len() > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("images"),
max: 10usize,
actual: value.len(),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Tag<S> {
fn nsid() -> &'static str {
"io.kich.recipe.recipe"
}
fn def_name() -> &'static str {
"tag"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_io_kich_recipe_recipe()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
fn _default_ingredient_is_detached() -> Option<bool> {
Some(false)
}
fn _default_ingredient_is_optional() -> Option<bool> {
Some(false)
}
fn lexicon_doc_io_kich_recipe_recipe() -> 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("io.kich.recipe.recipe"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("ingredient"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("id"), SmolStr::new_static("name")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("grams"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("group"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Optional group name for organizing ingredients (e.g., 'For the sauce:', 'For the pasta:')",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("heuristicAmount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("heuristicUnit"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Heuristic unit from parsed ingredient text (e.g., cup, cookies)",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("id"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Unique identifier for this ingredient"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("isDetached"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("isOptional"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("measuredAmount"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("measuredUnit"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Measured unit (g, kg, oz, lb, ml)"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Ingredient name")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notes"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Optional notes about this ingredient (e.g., original quantity)",
),
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("instructionStep"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("id"),
SmolStr::new_static("value"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("id"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Unique identifier for this instruction step",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("value"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Instruction text")),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
key: Some(CowStr::new_static("tid")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("name"),
SmolStr::new_static("servings"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cookTimeMinutes"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When this recipe was created"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdBy"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("description"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Recipe description")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("embedding"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Vector embedding for semantic similarity search (1024 dimensions, stored as JSON array of numbers)",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("imageUrl"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"[Deprecated] Image URL for the recipe. Use images blob array instead. Kept for legacy fallback.",
),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("images"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Recipe images as blobs (hero first; preferred over imageUrl)",
),
),
items: LexArrayItem::Blob(LexBlob { ..Default::default() }),
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("ingredients"),
LexObjectProperty::Array(LexArray {
description: Some(CowStr::new_static("Recipe ingredients")),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#ingredient"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("instructions"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Cooking instructions as an array of steps",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#instructionStep"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("isPrivate"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Recipe name")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("prepTimeMinutes"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("servings"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("source"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Source name (book, magazine, blog)"),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("Tags for categorizing the recipe"),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#tag"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When this recipe was last updated"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("url"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Source URL of the recipe"),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("variationOf"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tag"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("id"), SmolStr::new_static("name")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("id"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Tag identifier")),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Tag display name")),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
fn _default_recipe_is_private() -> Option<bool> {
Some(false)
}
fn _default_recipe_servings() -> i64 {
1i64
}
pub mod recipe_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 Name;
type Servings;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Name = Unset;
type Servings = 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 Name = St::Name;
type Servings = St::Servings;
}
pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetName<St> {}
impl<St: State> State for SetName<St> {
type CreatedAt = St::CreatedAt;
type Name = Set<members::name>;
type Servings = St::Servings;
}
pub struct SetServings<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetServings<St> {}
impl<St: State> State for SetServings<St> {
type CreatedAt = St::CreatedAt;
type Name = St::Name;
type Servings = Set<members::servings>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct name(());
pub struct servings(());
}
}
pub struct RecipeBuilder<S: BosStr, St: recipe_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<i64>,
Option<Datetime>,
Option<StrongRef<S>>,
Option<S>,
Option<S>,
Option<UriValue<S>>,
Option<Vec<BlobRef<S>>>,
Option<Vec<recipe::Ingredient<S>>>,
Option<Vec<recipe::InstructionStep<S>>>,
Option<bool>,
Option<S>,
Option<i64>,
Option<i64>,
Option<S>,
Option<Vec<recipe::Tag<S>>>,
Option<Datetime>,
Option<UriValue<S>>,
Option<StrongRef<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Recipe<S> {
pub fn new() -> RecipeBuilder<S, recipe_state::Empty> {
RecipeBuilder::new()
}
}
impl<S: BosStr> RecipeBuilder<S, recipe_state::Empty> {
pub fn new() -> Self {
RecipeBuilder {
_state: PhantomData,
_fields: (
None, None, None, None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn cook_time_minutes(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_cook_time_minutes(mut self, value: Option<i64>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> RecipeBuilder<S, St>
where
St: recipe_state::State,
St::CreatedAt: recipe_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> RecipeBuilder<S, recipe_state::SetCreatedAt<St>> {
self._fields.1 = Option::Some(value.into());
RecipeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn created_by(mut self, value: impl Into<Option<StrongRef<S>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_created_by(mut self, value: Option<StrongRef<S>>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn description(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<S>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn embedding(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_embedding(mut self, value: Option<S>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn image_url(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_image_url(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.5 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn images(mut self, value: impl Into<Option<Vec<BlobRef<S>>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_images(mut self, value: Option<Vec<BlobRef<S>>>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn ingredients(mut self, value: impl Into<Option<Vec<recipe::Ingredient<S>>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_ingredients(mut self, value: Option<Vec<recipe::Ingredient<S>>>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn instructions(
mut self,
value: impl Into<Option<Vec<recipe::InstructionStep<S>>>>,
) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_instructions(mut self, value: Option<Vec<recipe::InstructionStep<S>>>) -> Self {
self._fields.8 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn is_private(mut self, value: impl Into<Option<bool>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_is_private(mut self, value: Option<bool>) -> Self {
self._fields.9 = value;
self
}
}
impl<S: BosStr, St> RecipeBuilder<S, St>
where
St: recipe_state::State,
St::Name: recipe_state::IsUnset,
{
pub fn name(mut self, value: impl Into<S>) -> RecipeBuilder<S, recipe_state::SetName<St>> {
self._fields.10 = Option::Some(value.into());
RecipeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn prep_time_minutes(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_prep_time_minutes(mut self, value: Option<i64>) -> Self {
self._fields.11 = value;
self
}
}
impl<S: BosStr, St> RecipeBuilder<S, St>
where
St: recipe_state::State,
St::Servings: recipe_state::IsUnset,
{
pub fn servings(
mut self,
value: impl Into<i64>,
) -> RecipeBuilder<S, recipe_state::SetServings<St>> {
self._fields.12 = Option::Some(value.into());
RecipeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn source(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_source(mut self, value: Option<S>) -> Self {
self._fields.13 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn tags(mut self, value: impl Into<Option<Vec<recipe::Tag<S>>>>) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<Vec<recipe::Tag<S>>>) -> Self {
self._fields.14 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
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<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn url(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
self._fields.16 = value.into();
self
}
pub fn maybe_url(mut self, value: Option<UriValue<S>>) -> Self {
self._fields.16 = value;
self
}
}
impl<S: BosStr, St: recipe_state::State> RecipeBuilder<S, St> {
pub fn variation_of(mut self, value: impl Into<Option<StrongRef<S>>>) -> Self {
self._fields.17 = value.into();
self
}
pub fn maybe_variation_of(mut self, value: Option<StrongRef<S>>) -> Self {
self._fields.17 = value;
self
}
}
impl<S: BosStr, St> RecipeBuilder<S, St>
where
St: recipe_state::State,
St::CreatedAt: recipe_state::IsSet,
St::Name: recipe_state::IsSet,
St::Servings: recipe_state::IsSet,
{
pub fn build(self) -> Recipe<S> {
Recipe {
cook_time_minutes: self._fields.0,
created_at: self._fields.1.unwrap(),
created_by: self._fields.2,
description: self._fields.3,
embedding: self._fields.4,
image_url: self._fields.5,
images: self._fields.6,
ingredients: self._fields.7,
instructions: self._fields.8,
is_private: self._fields.9.or_else(|| Some(false)),
name: self._fields.10.unwrap(),
prep_time_minutes: self._fields.11,
servings: self._fields.12.unwrap(),
source: self._fields.13,
tags: self._fields.14,
updated_at: self._fields.15,
url: self._fields.16,
variation_of: self._fields.17,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Recipe<S> {
Recipe {
cook_time_minutes: self._fields.0,
created_at: self._fields.1.unwrap(),
created_by: self._fields.2,
description: self._fields.3,
embedding: self._fields.4,
image_url: self._fields.5,
images: self._fields.6,
ingredients: self._fields.7,
instructions: self._fields.8,
is_private: self._fields.9.or_else(|| Some(false)),
name: self._fields.10.unwrap(),
prep_time_minutes: self._fields.11,
servings: self._fields.12.unwrap(),
source: self._fields.13,
tags: self._fields.14,
updated_at: self._fields.15,
url: self._fields.16,
variation_of: self._fields.17,
extra_data: Some(extra_data),
}
}
}