#[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::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::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
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::repo::strong_ref::StrongRef;
use crate::io_kich::recipe::recipe;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Ingredient<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub grams: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub group: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub heuristic_amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub heuristic_unit: Option<CowStr<'a>>,
#[serde(borrow)]
pub id: CowStr<'a>,
#[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")]
#[serde(borrow)]
pub measured_unit: Option<CowStr<'a>>,
#[serde(borrow)]
pub name: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub notes: Option<CowStr<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct InstructionStep<'a> {
#[serde(borrow)]
pub id: CowStr<'a>,
#[serde(borrow)]
pub value: CowStr<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", rename = "io.kich.recipe.recipe", tag = "$type")]
pub struct Recipe<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cook_time_minutes: Option<i64>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub created_by: Option<StrongRef<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub description: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub embedding: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub image_url: Option<UriValue<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub images: Option<Vec<BlobRef<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub ingredients: Option<Vec<recipe::Ingredient<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub instructions: Option<Vec<recipe::InstructionStep<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_recipe_is_private")]
pub is_private: Option<bool>,
#[serde(borrow)]
pub name: CowStr<'a>,
#[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")]
#[serde(borrow)]
pub source: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tags: Option<Vec<recipe::Tag<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_at: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub url: Option<UriValue<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub variation_of: Option<StrongRef<'a>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RecipeGetRecordOutput<'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: Recipe<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Tag<'a> {
#[serde(borrow)]
pub id: CowStr<'a>,
#[serde(borrow)]
pub name: CowStr<'a>,
}
impl<'a> Recipe<'a> {
pub fn uri(
uri: impl Into<CowStr<'a>>,
) -> Result<RecordUri<'a, RecipeRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
}
}
impl<'a> LexiconSchema for Ingredient<'a> {
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<'a> LexiconSchema for InstructionStep<'a> {
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<'de> = RecipeGetRecordOutput<'de>;
type Err<'de> = RecordError<'de>;
}
impl From<RecipeGetRecordOutput<'_>> for Recipe<'_> {
fn from(output: RecipeGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl Collection for Recipe<'_> {
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<'a> LexiconSchema for Recipe<'a> {
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<'a> LexiconSchema for Tag<'a> {
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> {
#[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("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::{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> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<i64>,
Option<Datetime>,
Option<StrongRef<'a>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<UriValue<'a>>,
Option<Vec<BlobRef<'a>>>,
Option<Vec<recipe::Ingredient<'a>>>,
Option<Vec<recipe::InstructionStep<'a>>>,
Option<bool>,
Option<CowStr<'a>>,
Option<i64>,
Option<i64>,
Option<CowStr<'a>>,
Option<Vec<recipe::Tag<'a>>>,
Option<Datetime>,
Option<UriValue<'a>>,
Option<StrongRef<'a>>,
),
_lifetime: 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 {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_lifetime: PhantomData,
}
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
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<'a, S> RecipeBuilder<'a, S>
where
S: recipe_state::State,
S::CreatedAt: recipe_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> RecipeBuilder<'a, recipe_state::SetCreatedAt<S>> {
self._fields.1 = Option::Some(value.into());
RecipeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn created_by(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_created_by(mut self, value: Option<StrongRef<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn description(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_description(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn embedding(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_embedding(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.4 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn image_url(mut self, value: impl Into<Option<UriValue<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_image_url(mut self, value: Option<UriValue<'a>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn images(mut self, value: impl Into<Option<Vec<BlobRef<'a>>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_images(mut self, value: Option<Vec<BlobRef<'a>>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn ingredients(
mut self,
value: impl Into<Option<Vec<recipe::Ingredient<'a>>>>,
) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_ingredients(
mut self,
value: Option<Vec<recipe::Ingredient<'a>>>,
) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn instructions(
mut self,
value: impl Into<Option<Vec<recipe::InstructionStep<'a>>>>,
) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_instructions(
mut self,
value: Option<Vec<recipe::InstructionStep<'a>>>,
) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
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<'a, S> RecipeBuilder<'a, S>
where
S: recipe_state::State,
S::Name: recipe_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<CowStr<'a>>,
) -> RecipeBuilder<'a, recipe_state::SetName<S>> {
self._fields.10 = Option::Some(value.into());
RecipeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
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<'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._fields.12 = Option::Some(value.into());
RecipeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn source(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_source(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.13 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn tags(mut self, value: impl Into<Option<Vec<recipe::Tag<'a>>>>) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_tags(mut self, value: Option<Vec<recipe::Tag<'a>>>) -> Self {
self._fields.14 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
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<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn url(mut self, value: impl Into<Option<UriValue<'a>>>) -> Self {
self._fields.16 = value.into();
self
}
pub fn maybe_url(mut self, value: Option<UriValue<'a>>) -> Self {
self._fields.16 = value;
self
}
}
impl<'a, S: recipe_state::State> RecipeBuilder<'a, S> {
pub fn variation_of(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
self._fields.17 = value.into();
self
}
pub fn maybe_variation_of(mut self, value: Option<StrongRef<'a>>) -> Self {
self._fields.17 = 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._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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Recipe<'a> {
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),
}
}
}