#[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};
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::social_arabica::alpha::brew;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct EspressoParams<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub pre_infusion_seconds: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pressure: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub yield_weight: Option<i64>,
#[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 = "social.arabica.alpha.brew",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Brew<S: BosStr = DefaultStr> {
pub bean_ref: AtUri<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub brewer_ref: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub coffee_amount: Option<i64>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub espresso_params: Option<brew::EspressoParams<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub grind_size: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub grinder_ref: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pourover_params: Option<brew::PouroverParams<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pours: Option<Vec<brew::Pour<S>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub rating: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub recipe_ref: Option<AtUri<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tasting_notes: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub temperature: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub time_seconds: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub water_amount: Option<i64>,
#[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 BrewGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Brew<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Pour<S: BosStr = DefaultStr> {
pub time_seconds: i64,
pub water_amount: i64,
#[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 PouroverParams<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub bloom_seconds: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bloom_water: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bypass_water: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub drawdown_seconds: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub filter: Option<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> Brew<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, BrewRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
impl<S: BosStr> LexiconSchema for EspressoParams<S> {
fn nsid() -> &'static str {
"social.arabica.alpha.brew"
}
fn def_name() -> &'static str {
"espressoParams"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_arabica_alpha_brew()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.pre_infusion_seconds {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("pre_infusion_seconds"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.pressure {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("pressure"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.yield_weight {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("yield_weight"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct BrewRecord;
impl XrpcResp for BrewRecord {
const NSID: &'static str = "social.arabica.alpha.brew";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = BrewGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<BrewGetRecordOutput<S>> for Brew<S> {
fn from(output: BrewGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Brew<S> {
const NSID: &'static str = "social.arabica.alpha.brew";
type Record = BrewRecord;
}
impl Collection for BrewRecord {
const NSID: &'static str = "social.arabica.alpha.brew";
type Record = BrewRecord;
}
impl<S: BosStr> LexiconSchema for Brew<S> {
fn nsid() -> &'static str {
"social.arabica.alpha.brew"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_arabica_alpha_brew()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.coffee_amount {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("coffee_amount"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.grind_size {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 50usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("grind_size"),
max: 50usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.method {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("method"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.rating {
if *value > 10i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("rating"),
max: 10i64,
actual: *value,
});
}
}
if let Some(ref value) = self.rating {
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("rating"),
min: 1i64,
actual: *value,
});
}
}
if let Some(ref value) = self.tasting_notes {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 2000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("tasting_notes"),
max: 2000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.temperature {
if *value > 1000i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("temperature"),
max: 1000i64,
actual: *value,
});
}
}
if let Some(ref value) = self.temperature {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("temperature"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.time_seconds {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("time_seconds"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.water_amount {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("water_amount"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Pour<S> {
fn nsid() -> &'static str {
"social.arabica.alpha.brew"
}
fn def_name() -> &'static str {
"pour"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_arabica_alpha_brew()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.time_seconds;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("time_seconds"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.water_amount;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("water_amount"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for PouroverParams<S> {
fn nsid() -> &'static str {
"social.arabica.alpha.brew"
}
fn def_name() -> &'static str {
"pouroverParams"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_social_arabica_alpha_brew()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.bloom_seconds {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("bloom_seconds"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.bloom_water {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("bloom_water"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.bypass_water {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("bypass_water"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.drawdown_seconds {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("drawdown_seconds"),
min: 0i64,
actual: *value,
});
}
}
if let Some(ref value) = self.filter {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("filter"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
fn lexicon_doc_social_arabica_alpha_brew() -> 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("social.arabica.alpha.brew"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("espressoParams"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Parameters specific to espresso brewing"),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("preInfusionSeconds"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("pressure"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("yieldWeight"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
description: Some(
CowStr::new_static(
"A coffee brewing session with parameters and notes",
),
),
key: Some(CowStr::new_static("tid")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("beanRef"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("beanRef"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"AT-URI reference to the bean record used",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("brewerRef"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"AT-URI reference to the brewer/device used",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("coffeeAmount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Timestamp when the brew was made"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("espressoParams"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#espressoParams"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("grindSize"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Grind size setting (can be numeric like '18' or descriptive like 'Medium')",
),
),
max_length: Some(50usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("grinderRef"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("AT-URI reference to the grinder used"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("method"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Brewing method (e.g., 'Pour Over', 'French Press', 'Espresso')",
),
),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("pouroverParams"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#pouroverParams"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("pours"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Array of pour information for multi-pour methods (e.g., V60)",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#pour"),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("rating"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
maximum: Some(10i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("recipeRef"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"AT-URI reference to the recipe used for this brew",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tastingNotes"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Tasting notes and observations about the brew",
),
),
max_length: Some(2000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("temperature"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(1000i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("timeSeconds"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("waterAmount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("pour"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Information about a single pour in a multi-pour brewing method",
),
),
required: Some(
vec![
SmolStr::new_static("waterAmount"),
SmolStr::new_static("timeSeconds")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("timeSeconds"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("waterAmount"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("pouroverParams"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Parameters specific to pour-over brewing"),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("bloomSeconds"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("bloomWater"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("bypassWater"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("drawdownSeconds"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("filter"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Type of filter used (e.g. paper, metal, cloth)",
),
),
max_length: Some(100usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod brew_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 BeanRef;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type BeanRef = Unset;
type CreatedAt = Unset;
}
pub struct SetBeanRef<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBeanRef<St> {}
impl<St: State> State for SetBeanRef<St> {
type BeanRef = Set<members::bean_ref>;
type CreatedAt = St::CreatedAt;
}
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 BeanRef = St::BeanRef;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct bean_ref(());
pub struct created_at(());
}
}
pub struct BrewBuilder<St: brew_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<AtUri<S>>,
Option<AtUri<S>>,
Option<i64>,
Option<Datetime>,
Option<brew::EspressoParams<S>>,
Option<S>,
Option<AtUri<S>>,
Option<S>,
Option<brew::PouroverParams<S>>,
Option<Vec<brew::Pour<S>>>,
Option<i64>,
Option<AtUri<S>>,
Option<S>,
Option<i64>,
Option<i64>,
Option<i64>,
),
_type: PhantomData<fn() -> S>,
}
impl Brew<DefaultStr> {
pub fn new() -> BrewBuilder<brew_state::Empty, DefaultStr> {
BrewBuilder::new()
}
}
impl<S: BosStr> Brew<S> {
pub fn builder() -> BrewBuilder<brew_state::Empty, S> {
BrewBuilder::builder()
}
}
impl BrewBuilder<brew_state::Empty, DefaultStr> {
pub fn new() -> Self {
BrewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<S: BosStr> BrewBuilder<brew_state::Empty, S> {
pub fn builder() -> Self {
BrewBuilder {
_state: PhantomData,
_fields: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> BrewBuilder<St, S>
where
St: brew_state::State,
St::BeanRef: brew_state::IsUnset,
{
pub fn bean_ref(
mut self,
value: impl Into<AtUri<S>>,
) -> BrewBuilder<brew_state::SetBeanRef<St>, S> {
self._fields.0 = Option::Some(value.into());
BrewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn brewer_ref(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_brewer_ref(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn coffee_amount(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_coffee_amount(mut self, value: Option<i64>) -> Self {
self._fields.2 = value;
self
}
}
impl<St, S: BosStr> BrewBuilder<St, S>
where
St: brew_state::State,
St::CreatedAt: brew_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> BrewBuilder<brew_state::SetCreatedAt<St>, S> {
self._fields.3 = Option::Some(value.into());
BrewBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn espresso_params(
mut self,
value: impl Into<Option<brew::EspressoParams<S>>>,
) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_espresso_params(
mut self,
value: Option<brew::EspressoParams<S>>,
) -> Self {
self._fields.4 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn grind_size(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_grind_size(mut self, value: Option<S>) -> Self {
self._fields.5 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn grinder_ref(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_grinder_ref(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.6 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn method(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_method(mut self, value: Option<S>) -> Self {
self._fields.7 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn pourover_params(
mut self,
value: impl Into<Option<brew::PouroverParams<S>>>,
) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_pourover_params(
mut self,
value: Option<brew::PouroverParams<S>>,
) -> Self {
self._fields.8 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn pours(mut self, value: impl Into<Option<Vec<brew::Pour<S>>>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_pours(mut self, value: Option<Vec<brew::Pour<S>>>) -> Self {
self._fields.9 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn rating(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.10 = value.into();
self
}
pub fn maybe_rating(mut self, value: Option<i64>) -> Self {
self._fields.10 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn recipe_ref(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
self._fields.11 = value.into();
self
}
pub fn maybe_recipe_ref(mut self, value: Option<AtUri<S>>) -> Self {
self._fields.11 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn tasting_notes(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.12 = value.into();
self
}
pub fn maybe_tasting_notes(mut self, value: Option<S>) -> Self {
self._fields.12 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn temperature(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.13 = value.into();
self
}
pub fn maybe_temperature(mut self, value: Option<i64>) -> Self {
self._fields.13 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn time_seconds(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.14 = value.into();
self
}
pub fn maybe_time_seconds(mut self, value: Option<i64>) -> Self {
self._fields.14 = value;
self
}
}
impl<St: brew_state::State, S: BosStr> BrewBuilder<St, S> {
pub fn water_amount(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.15 = value.into();
self
}
pub fn maybe_water_amount(mut self, value: Option<i64>) -> Self {
self._fields.15 = value;
self
}
}
impl<St, S: BosStr> BrewBuilder<St, S>
where
St: brew_state::State,
St::BeanRef: brew_state::IsSet,
St::CreatedAt: brew_state::IsSet,
{
pub fn build(self) -> Brew<S> {
Brew {
bean_ref: self._fields.0.unwrap(),
brewer_ref: self._fields.1,
coffee_amount: self._fields.2,
created_at: self._fields.3.unwrap(),
espresso_params: self._fields.4,
grind_size: self._fields.5,
grinder_ref: self._fields.6,
method: self._fields.7,
pourover_params: self._fields.8,
pours: self._fields.9,
rating: self._fields.10,
recipe_ref: self._fields.11,
tasting_notes: self._fields.12,
temperature: self._fields.13,
time_seconds: self._fields.14,
water_amount: self._fields.15,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Brew<S> {
Brew {
bean_ref: self._fields.0.unwrap(),
brewer_ref: self._fields.1,
coffee_amount: self._fields.2,
created_at: self._fields.3.unwrap(),
espresso_params: self._fields.4,
grind_size: self._fields.5,
grinder_ref: self._fields.6,
method: self._fields.7,
pourover_params: self._fields.8,
pours: self._fields.9,
rating: self._fields.10,
recipe_ref: self._fields.11,
tasting_notes: self._fields.12,
temperature: self._fields.13,
time_seconds: self._fields.14,
water_amount: self._fields.15,
extra_data: Some(extra_data),
}
}
}
pub mod pour_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 TimeSeconds;
type WaterAmount;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type TimeSeconds = Unset;
type WaterAmount = Unset;
}
pub struct SetTimeSeconds<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTimeSeconds<St> {}
impl<St: State> State for SetTimeSeconds<St> {
type TimeSeconds = Set<members::time_seconds>;
type WaterAmount = St::WaterAmount;
}
pub struct SetWaterAmount<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetWaterAmount<St> {}
impl<St: State> State for SetWaterAmount<St> {
type TimeSeconds = St::TimeSeconds;
type WaterAmount = Set<members::water_amount>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct time_seconds(());
pub struct water_amount(());
}
}
pub struct PourBuilder<St: pour_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl Pour<DefaultStr> {
pub fn new() -> PourBuilder<pour_state::Empty, DefaultStr> {
PourBuilder::new()
}
}
impl<S: BosStr> Pour<S> {
pub fn builder() -> PourBuilder<pour_state::Empty, S> {
PourBuilder::builder()
}
}
impl PourBuilder<pour_state::Empty, DefaultStr> {
pub fn new() -> Self {
PourBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> PourBuilder<pour_state::Empty, S> {
pub fn builder() -> Self {
PourBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PourBuilder<St, S>
where
St: pour_state::State,
St::TimeSeconds: pour_state::IsUnset,
{
pub fn time_seconds(
mut self,
value: impl Into<i64>,
) -> PourBuilder<pour_state::SetTimeSeconds<St>, S> {
self._fields.0 = Option::Some(value.into());
PourBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PourBuilder<St, S>
where
St: pour_state::State,
St::WaterAmount: pour_state::IsUnset,
{
pub fn water_amount(
mut self,
value: impl Into<i64>,
) -> PourBuilder<pour_state::SetWaterAmount<St>, S> {
self._fields.1 = Option::Some(value.into());
PourBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PourBuilder<St, S>
where
St: pour_state::State,
St::TimeSeconds: pour_state::IsSet,
St::WaterAmount: pour_state::IsSet,
{
pub fn build(self) -> Pour<S> {
Pour {
time_seconds: self._fields.0.unwrap(),
water_amount: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Pour<S> {
Pour {
time_seconds: self._fields.0.unwrap(),
water_amount: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}