#[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};
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::app_dropanchor::checkin;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Address<'a> {
#[serde(borrow)]
pub country: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub locality: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub name: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub postal_code: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub region: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub street: Option<CowStr<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct CheckinImage<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub alt: Option<CowStr<'a>>,
#[serde(borrow)]
pub fullsize: BlobRef<'a>,
#[serde(borrow)]
pub thumb: BlobRef<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct FsqPlace<'a> {
#[serde(borrow)]
pub fsq_place_id: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub latitude: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub longitude: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub name: Option<CowStr<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Geo<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub altitude: Option<CowStr<'a>>,
#[serde(borrow)]
pub latitude: CowStr<'a>,
#[serde(borrow)]
pub longitude: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub name: Option<CowStr<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Checkin<'a> {
#[serde(borrow)]
pub address: checkin::Address<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub category: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub category_group: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub category_icon: Option<CowStr<'a>>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub fsq: Option<checkin::FsqPlace<'a>>,
#[serde(borrow)]
pub geo: checkin::Geo<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub image: Option<checkin::CheckinImage<'a>>,
#[serde(borrow)]
pub text: CowStr<'a>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct CheckinGetRecordOutput<'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: Checkin<'a>,
}
impl<'a> Checkin<'a> {
pub fn uri(
uri: impl Into<CowStr<'a>>,
) -> Result<RecordUri<'a, CheckinRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
}
}
impl<'a> LexiconSchema for Address<'a> {
fn nsid() -> &'static str {
"app.dropanchor.checkin"
}
fn def_name() -> &'static str {
"address"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_dropanchor_checkin()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.country;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("country"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.country;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) < 2usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("country"),
min: 2usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.locality {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 200usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("locality"),
max: 200usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.name {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 500usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("name"),
max: 500usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.postal_code {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 20usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("postal_code"),
max: 20usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.region {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 200usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("region"),
max: 200usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.street {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 500usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("street"),
max: 500usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for CheckinImage<'a> {
fn nsid() -> &'static str {
"app.dropanchor.checkin"
}
fn def_name() -> &'static str {
"checkinImage"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_dropanchor_checkin()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.alt {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 1000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("alt"),
max: 1000usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.fullsize;
{
let size = value.blob().size;
if size > 2000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("fullsize"),
max: 2000000usize,
actual: size,
});
}
}
}
{
let value = &self.fullsize;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["image/jpeg", "image/png", "image/webp"];
let matched = accepted
.iter()
.any(|pattern| {
if *pattern == "*/*" {
true
} else if pattern.ends_with("/*") {
let prefix = &pattern[..pattern.len() - 2];
mime.starts_with(prefix)
&& mime.as_bytes().get(prefix.len()) == Some(&b'/')
} else {
mime == *pattern
}
});
if !matched {
return Err(ConstraintError::BlobMimeTypeNotAccepted {
path: ValidationPath::from_field("fullsize"),
accepted: vec![
"image/jpeg".to_string(), "image/png".to_string(),
"image/webp".to_string()
],
actual: mime.to_string(),
});
}
}
}
{
let value = &self.thumb;
{
let size = value.blob().size;
if size > 300000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("thumb"),
max: 300000usize,
actual: size,
});
}
}
}
{
let value = &self.thumb;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["image/jpeg", "image/png", "image/webp"];
let matched = accepted
.iter()
.any(|pattern| {
if *pattern == "*/*" {
true
} else if pattern.ends_with("/*") {
let prefix = &pattern[..pattern.len() - 2];
mime.starts_with(prefix)
&& mime.as_bytes().get(prefix.len()) == Some(&b'/')
} else {
mime == *pattern
}
});
if !matched {
return Err(ConstraintError::BlobMimeTypeNotAccepted {
path: ValidationPath::from_field("thumb"),
accepted: vec![
"image/jpeg".to_string(), "image/png".to_string(),
"image/webp".to_string()
],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
impl<'a> LexiconSchema for FsqPlace<'a> {
fn nsid() -> &'static str {
"app.dropanchor.checkin"
}
fn def_name() -> &'static str {
"fsqPlace"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_dropanchor_checkin()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.fsq_place_id;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("fsq_place_id"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.latitude {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 32usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("latitude"),
max: 32usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.longitude {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 32usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("longitude"),
max: 32usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.name {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 500usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("name"),
max: 500usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for Geo<'a> {
fn nsid() -> &'static str {
"app.dropanchor.checkin"
}
fn def_name() -> &'static str {
"geo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_dropanchor_checkin()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.altitude {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 32usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("altitude"),
max: 32usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.latitude;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 32usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("latitude"),
max: 32usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.longitude;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 32usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("longitude"),
max: 32usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.name {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 500usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("name"),
max: 500usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CheckinRecord;
impl XrpcResp for CheckinRecord {
const NSID: &'static str = "app.dropanchor.checkin";
const ENCODING: &'static str = "application/json";
type Output<'de> = CheckinGetRecordOutput<'de>;
type Err<'de> = RecordError<'de>;
}
impl From<CheckinGetRecordOutput<'_>> for Checkin<'_> {
fn from(output: CheckinGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl Collection for Checkin<'_> {
const NSID: &'static str = "app.dropanchor.checkin";
type Record = CheckinRecord;
}
impl Collection for CheckinRecord {
const NSID: &'static str = "app.dropanchor.checkin";
type Record = CheckinRecord;
}
impl<'a> LexiconSchema for Checkin<'a> {
fn nsid() -> &'static str {
"app.dropanchor.checkin"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_dropanchor_checkin()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.category {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("category"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.category_group {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("category_group"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.category_icon {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("category_icon"),
max: 10usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.text;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 3000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("text"),
max: 3000usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
fn lexicon_doc_app_dropanchor_checkin() -> 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("app.dropanchor.checkin"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("address"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Street address (based on community.lexicon.location.address)",
),
),
required: Some(vec![SmolStr::new_static("country")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("country"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The ISO 3166 country code (preferably 2-letter)",
),
),
min_length: Some(2usize),
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("locality"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The locality (city, town, etc.)"),
),
max_length: Some(200usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The name of the location"),
),
max_length: Some(500usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("postalCode"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("The postal code")),
max_length: Some(20usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("region"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The administrative region (state, province, etc.)",
),
),
max_length: Some(200usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("street"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("The street address")),
max_length: Some(500usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("checkinImage"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Image attachment with thumbnail and full-size versions",
),
),
required: Some(
vec![
SmolStr::new_static("thumb"), SmolStr::new_static("fullsize")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("alt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Alt text for accessibility"),
),
max_length: Some(1000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("fullsize"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map.insert(
SmolStr::new_static("thumb"),
LexObjectProperty::Blob(LexBlob { ..Default::default() }),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("fsqPlace"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Foursquare venue data (based on community.lexicon.location.fsq)",
),
),
required: Some(vec![SmolStr::new_static("fsqPlaceId")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("fsqPlaceId"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The unique identifier of a Foursquare POI",
),
),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("latitude"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Latitude in decimal degrees"),
),
max_length: Some(32usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("longitude"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Longitude in decimal degrees"),
),
max_length: Some(32usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The name of the location"),
),
max_length: Some(500usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("geo"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Geographic coordinates in WGS84 (based on community.lexicon.location.geo)",
),
),
required: Some(
vec![
SmolStr::new_static("latitude"),
SmolStr::new_static("longitude")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("altitude"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Altitude in meters")),
max_length: Some(32usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("latitude"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Latitude in decimal degrees (range: -90 to 90)",
),
),
max_length: Some(32usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("longitude"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Longitude in decimal degrees (range: -180 to 180)",
),
),
max_length: Some(32usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Name of the location"),
),
max_length: Some(500usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
description: Some(
CowStr::new_static(
"A location check-in record for the Anchor app",
),
),
key: Some(CowStr::new_static("tid")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("text"),
SmolStr::new_static("createdAt"),
SmolStr::new_static("address"), SmolStr::new_static("geo")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("address"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#address"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("category"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Place category (e.g., cafe, restaurant)",
),
),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("categoryGroup"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Category group for organization"),
),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("categoryIcon"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Emoji icon for the category"),
),
max_length: Some(10usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("When the check-in was created"),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("fsq"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#fsqPlace"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("geo"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#geo"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("image"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#checkinImage"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("text"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The check-in message or note"),
),
max_length: Some(3000usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod checkin_image_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 Thumb;
type Fullsize;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Thumb = Unset;
type Fullsize = Unset;
}
pub struct SetThumb<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetThumb<S> {}
impl<S: State> State for SetThumb<S> {
type Thumb = Set<members::thumb>;
type Fullsize = S::Fullsize;
}
pub struct SetFullsize<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetFullsize<S> {}
impl<S: State> State for SetFullsize<S> {
type Thumb = S::Thumb;
type Fullsize = Set<members::fullsize>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct thumb(());
pub struct fullsize(());
}
}
pub struct CheckinImageBuilder<'a, S: checkin_image_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<BlobRef<'a>>, Option<BlobRef<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> CheckinImage<'a> {
pub fn new() -> CheckinImageBuilder<'a, checkin_image_state::Empty> {
CheckinImageBuilder::new()
}
}
impl<'a> CheckinImageBuilder<'a, checkin_image_state::Empty> {
pub fn new() -> Self {
CheckinImageBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: checkin_image_state::State> CheckinImageBuilder<'a, S> {
pub fn alt(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_alt(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S> CheckinImageBuilder<'a, S>
where
S: checkin_image_state::State,
S::Fullsize: checkin_image_state::IsUnset,
{
pub fn fullsize(
mut self,
value: impl Into<BlobRef<'a>>,
) -> CheckinImageBuilder<'a, checkin_image_state::SetFullsize<S>> {
self._fields.1 = Option::Some(value.into());
CheckinImageBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CheckinImageBuilder<'a, S>
where
S: checkin_image_state::State,
S::Thumb: checkin_image_state::IsUnset,
{
pub fn thumb(
mut self,
value: impl Into<BlobRef<'a>>,
) -> CheckinImageBuilder<'a, checkin_image_state::SetThumb<S>> {
self._fields.2 = Option::Some(value.into());
CheckinImageBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CheckinImageBuilder<'a, S>
where
S: checkin_image_state::State,
S::Thumb: checkin_image_state::IsSet,
S::Fullsize: checkin_image_state::IsSet,
{
pub fn build(self) -> CheckinImage<'a> {
CheckinImage {
alt: self._fields.0,
fullsize: self._fields.1.unwrap(),
thumb: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> CheckinImage<'a> {
CheckinImage {
alt: self._fields.0,
fullsize: self._fields.1.unwrap(),
thumb: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod checkin_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 Text;
type CreatedAt;
type Address;
type Geo;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Text = Unset;
type CreatedAt = Unset;
type Address = Unset;
type Geo = Unset;
}
pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetText<S> {}
impl<S: State> State for SetText<S> {
type Text = Set<members::text>;
type CreatedAt = S::CreatedAt;
type Address = S::Address;
type Geo = S::Geo;
}
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 Text = S::Text;
type CreatedAt = Set<members::created_at>;
type Address = S::Address;
type Geo = S::Geo;
}
pub struct SetAddress<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAddress<S> {}
impl<S: State> State for SetAddress<S> {
type Text = S::Text;
type CreatedAt = S::CreatedAt;
type Address = Set<members::address>;
type Geo = S::Geo;
}
pub struct SetGeo<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetGeo<S> {}
impl<S: State> State for SetGeo<S> {
type Text = S::Text;
type CreatedAt = S::CreatedAt;
type Address = S::Address;
type Geo = Set<members::geo>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct text(());
pub struct created_at(());
pub struct address(());
pub struct geo(());
}
}
pub struct CheckinBuilder<'a, S: checkin_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<checkin::Address<'a>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<Datetime>,
Option<checkin::FsqPlace<'a>>,
Option<checkin::Geo<'a>>,
Option<checkin::CheckinImage<'a>>,
Option<CowStr<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Checkin<'a> {
pub fn new() -> CheckinBuilder<'a, checkin_state::Empty> {
CheckinBuilder::new()
}
}
impl<'a> CheckinBuilder<'a, checkin_state::Empty> {
pub fn new() -> Self {
CheckinBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> CheckinBuilder<'a, S>
where
S: checkin_state::State,
S::Address: checkin_state::IsUnset,
{
pub fn address(
mut self,
value: impl Into<checkin::Address<'a>>,
) -> CheckinBuilder<'a, checkin_state::SetAddress<S>> {
self._fields.0 = Option::Some(value.into());
CheckinBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: checkin_state::State> CheckinBuilder<'a, S> {
pub fn category(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_category(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S: checkin_state::State> CheckinBuilder<'a, S> {
pub fn category_group(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_category_group(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: checkin_state::State> CheckinBuilder<'a, S> {
pub fn category_icon(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_category_icon(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> CheckinBuilder<'a, S>
where
S: checkin_state::State,
S::CreatedAt: checkin_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> CheckinBuilder<'a, checkin_state::SetCreatedAt<S>> {
self._fields.4 = Option::Some(value.into());
CheckinBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: checkin_state::State> CheckinBuilder<'a, S> {
pub fn fsq(mut self, value: impl Into<Option<checkin::FsqPlace<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_fsq(mut self, value: Option<checkin::FsqPlace<'a>>) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S> CheckinBuilder<'a, S>
where
S: checkin_state::State,
S::Geo: checkin_state::IsUnset,
{
pub fn geo(
mut self,
value: impl Into<checkin::Geo<'a>>,
) -> CheckinBuilder<'a, checkin_state::SetGeo<S>> {
self._fields.6 = Option::Some(value.into());
CheckinBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: checkin_state::State> CheckinBuilder<'a, S> {
pub fn image(mut self, value: impl Into<Option<checkin::CheckinImage<'a>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_image(mut self, value: Option<checkin::CheckinImage<'a>>) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S> CheckinBuilder<'a, S>
where
S: checkin_state::State,
S::Text: checkin_state::IsUnset,
{
pub fn text(
mut self,
value: impl Into<CowStr<'a>>,
) -> CheckinBuilder<'a, checkin_state::SetText<S>> {
self._fields.8 = Option::Some(value.into());
CheckinBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> CheckinBuilder<'a, S>
where
S: checkin_state::State,
S::Text: checkin_state::IsSet,
S::CreatedAt: checkin_state::IsSet,
S::Address: checkin_state::IsSet,
S::Geo: checkin_state::IsSet,
{
pub fn build(self) -> Checkin<'a> {
Checkin {
address: self._fields.0.unwrap(),
category: self._fields.1,
category_group: self._fields.2,
category_icon: self._fields.3,
created_at: self._fields.4.unwrap(),
fsq: self._fields.5,
geo: self._fields.6.unwrap(),
image: self._fields.7,
text: self._fields.8.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Checkin<'a> {
Checkin {
address: self._fields.0.unwrap(),
category: self._fields.1,
category_group: self._fields.2,
category_icon: self._fields.3,
created_at: self._fields.4.unwrap(),
fsq: self._fields.5,
geo: self._fields.6.unwrap(),
image: self._fields.7,
text: self._fields.8.unwrap(),
extra_data: Some(extra_data),
}
}
}