pub mod begin;
pub mod get_config;
pub mod get_state;
#[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::string::Datetime;
use jacquard_derive::{IntoStatic, lexicon, open_union};
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_bsky::ageassurance;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Access<'a> {
Unknown,
None,
Safe,
Full,
Other(CowStr<'a>),
}
impl<'a> Access<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Unknown => "unknown",
Self::None => "none",
Self::Safe => "safe",
Self::Full => "full",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for Access<'a> {
fn from(s: &'a str) -> Self {
match s {
"unknown" => Self::Unknown,
"none" => Self::None,
"safe" => Self::Safe,
"full" => Self::Full,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for Access<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"unknown" => Self::Unknown,
"none" => Self::None,
"safe" => Self::Safe,
"full" => Self::Full,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> AsRef<str> for Access<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> core::fmt::Display for Access<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> serde::Serialize for Access<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for Access<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl jacquard_common::IntoStatic for Access<'_> {
type Output = Access<'static>;
fn into_static(self) -> Self::Output {
match self {
Access::Unknown => Access::Unknown,
Access::None => Access::None,
Access::Safe => Access::Safe,
Access::Full => Access::Full,
Access::Other(v) => Access::Other(v.into_static()),
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Config<'a> {
#[serde(borrow)]
pub regions: Vec<ageassurance::ConfigRegion<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegion<'a> {
#[serde(borrow)]
pub country_code: CowStr<'a>,
pub min_access_age: i64,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub region_code: Option<CowStr<'a>>,
#[serde(borrow)]
pub rules: Vec<ConfigRegionRulesItem<'a>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
pub enum ConfigRegionRulesItem<'a> {
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleDefault")]
ConfigRegionRuleDefault(Box<ageassurance::ConfigRegionRuleDefault<'a>>),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge")]
ConfigRegionRuleIfDeclaredOverAge(
Box<ageassurance::ConfigRegionRuleIfDeclaredOverAge<'a>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge")]
ConfigRegionRuleIfDeclaredUnderAge(
Box<ageassurance::ConfigRegionRuleIfDeclaredUnderAge<'a>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge")]
ConfigRegionRuleIfAssuredOverAge(
Box<ageassurance::ConfigRegionRuleIfAssuredOverAge<'a>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge")]
ConfigRegionRuleIfAssuredUnderAge(
Box<ageassurance::ConfigRegionRuleIfAssuredUnderAge<'a>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan")]
ConfigRegionRuleIfAccountNewerThan(
Box<ageassurance::ConfigRegionRuleIfAccountNewerThan<'a>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan")]
ConfigRegionRuleIfAccountOlderThan(
Box<ageassurance::ConfigRegionRuleIfAccountOlderThan<'a>>,
),
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleDefault<'a> {
#[serde(borrow)]
pub access: ageassurance::Access<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfAccountNewerThan<'a> {
#[serde(borrow)]
pub access: ageassurance::Access<'a>,
pub date: Datetime,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfAccountOlderThan<'a> {
#[serde(borrow)]
pub access: ageassurance::Access<'a>,
pub date: Datetime,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfAssuredOverAge<'a> {
#[serde(borrow)]
pub access: ageassurance::Access<'a>,
pub age: i64,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfAssuredUnderAge<'a> {
#[serde(borrow)]
pub access: ageassurance::Access<'a>,
pub age: i64,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfDeclaredOverAge<'a> {
#[serde(borrow)]
pub access: ageassurance::Access<'a>,
pub age: i64,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfDeclaredUnderAge<'a> {
#[serde(borrow)]
pub access: ageassurance::Access<'a>,
pub age: i64,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Event<'a> {
#[serde(borrow)]
pub access: EventAccess<'a>,
#[serde(borrow)]
pub attempt_id: CowStr<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub complete_ip: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub complete_ua: Option<CowStr<'a>>,
#[serde(borrow)]
pub country_code: CowStr<'a>,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub email: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub init_ip: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub init_ua: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub region_code: Option<CowStr<'a>>,
#[serde(borrow)]
pub status: EventStatus<'a>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EventAccess<'a> {
Unknown,
None,
Safe,
Full,
Other(CowStr<'a>),
}
impl<'a> EventAccess<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Unknown => "unknown",
Self::None => "none",
Self::Safe => "safe",
Self::Full => "full",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for EventAccess<'a> {
fn from(s: &'a str) -> Self {
match s {
"unknown" => Self::Unknown,
"none" => Self::None,
"safe" => Self::Safe,
"full" => Self::Full,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for EventAccess<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"unknown" => Self::Unknown,
"none" => Self::None,
"safe" => Self::Safe,
"full" => Self::Full,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for EventAccess<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for EventAccess<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for EventAccess<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for EventAccess<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for EventAccess<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for EventAccess<'_> {
type Output = EventAccess<'static>;
fn into_static(self) -> Self::Output {
match self {
EventAccess::Unknown => EventAccess::Unknown,
EventAccess::None => EventAccess::None,
EventAccess::Safe => EventAccess::Safe,
EventAccess::Full => EventAccess::Full,
EventAccess::Other(v) => EventAccess::Other(v.into_static()),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EventStatus<'a> {
Unknown,
Pending,
Assured,
Blocked,
Other(CowStr<'a>),
}
impl<'a> EventStatus<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Unknown => "unknown",
Self::Pending => "pending",
Self::Assured => "assured",
Self::Blocked => "blocked",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for EventStatus<'a> {
fn from(s: &'a str) -> Self {
match s {
"unknown" => Self::Unknown,
"pending" => Self::Pending,
"assured" => Self::Assured,
"blocked" => Self::Blocked,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for EventStatus<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"unknown" => Self::Unknown,
"pending" => Self::Pending,
"assured" => Self::Assured,
"blocked" => Self::Blocked,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for EventStatus<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for EventStatus<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for EventStatus<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for EventStatus<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for EventStatus<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for EventStatus<'_> {
type Output = EventStatus<'static>;
fn into_static(self) -> Self::Output {
match self {
EventStatus::Unknown => EventStatus::Unknown,
EventStatus::Pending => EventStatus::Pending,
EventStatus::Assured => EventStatus::Assured,
EventStatus::Blocked => EventStatus::Blocked,
EventStatus::Other(v) => EventStatus::Other(v.into_static()),
}
}
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct State<'a> {
#[serde(borrow)]
pub access: ageassurance::Access<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_initiated_at: Option<Datetime>,
#[serde(borrow)]
pub status: ageassurance::Status<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct StateMetadata<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub account_created_at: Option<Datetime>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Status<'a> {
Unknown,
Pending,
Assured,
Blocked,
Other(CowStr<'a>),
}
impl<'a> Status<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Unknown => "unknown",
Self::Pending => "pending",
Self::Assured => "assured",
Self::Blocked => "blocked",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for Status<'a> {
fn from(s: &'a str) -> Self {
match s {
"unknown" => Self::Unknown,
"pending" => Self::Pending,
"assured" => Self::Assured,
"blocked" => Self::Blocked,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for Status<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"unknown" => Self::Unknown,
"pending" => Self::Pending,
"assured" => Self::Assured,
"blocked" => Self::Blocked,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> AsRef<str> for Status<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> core::fmt::Display for Status<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> serde::Serialize for Status<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for Status<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl jacquard_common::IntoStatic for Status<'_> {
type Output = Status<'static>;
fn into_static(self) -> Self::Output {
match self {
Status::Unknown => Status::Unknown,
Status::Pending => Status::Pending,
Status::Assured => Status::Assured,
Status::Blocked => Status::Blocked,
Status::Other(v) => Status::Other(v.into_static()),
}
}
}
impl<'a> LexiconSchema for Config<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"config"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ConfigRegion<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"configRegion"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ConfigRegionRuleDefault<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"configRegionRuleDefault"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ConfigRegionRuleIfAccountNewerThan<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"configRegionRuleIfAccountNewerThan"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ConfigRegionRuleIfAccountOlderThan<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"configRegionRuleIfAccountOlderThan"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ConfigRegionRuleIfAssuredOverAge<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"configRegionRuleIfAssuredOverAge"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ConfigRegionRuleIfAssuredUnderAge<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"configRegionRuleIfAssuredUnderAge"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ConfigRegionRuleIfDeclaredOverAge<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"configRegionRuleIfDeclaredOverAge"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for ConfigRegionRuleIfDeclaredUnderAge<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"configRegionRuleIfDeclaredUnderAge"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for Event<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"event"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for State<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"state"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for StateMetadata<'a> {
fn nsid() -> &'static str {
"app.bsky.ageassurance.defs"
}
fn def_name() -> &'static str {
"stateMetadata"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_ageassurance_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod config_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 Regions;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Regions = Unset;
}
pub struct SetRegions<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRegions<S> {}
impl<S: State> State for SetRegions<S> {
type Regions = Set<members::regions>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct regions(());
}
}
pub struct ConfigBuilder<'a, S: config_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Vec<ageassurance::ConfigRegion<'a>>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Config<'a> {
pub fn new() -> ConfigBuilder<'a, config_state::Empty> {
ConfigBuilder::new()
}
}
impl<'a> ConfigBuilder<'a, config_state::Empty> {
pub fn new() -> Self {
ConfigBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigBuilder<'a, S>
where
S: config_state::State,
S::Regions: config_state::IsUnset,
{
pub fn regions(
mut self,
value: impl Into<Vec<ageassurance::ConfigRegion<'a>>>,
) -> ConfigBuilder<'a, config_state::SetRegions<S>> {
self._fields.0 = Option::Some(value.into());
ConfigBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigBuilder<'a, S>
where
S: config_state::State,
S::Regions: config_state::IsSet,
{
pub fn build(self) -> Config<'a> {
Config {
regions: self._fields.0.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>,
>,
) -> Config<'a> {
Config {
regions: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_ageassurance_defs() -> 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.bsky.ageassurance.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexUserType::String(LexString {
description: Some(
CowStr::new_static(
"The access level granted based on Age Assurance data we've processed.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("config"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("")),
required: Some(vec![SmolStr::new_static("regions")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("regions"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"The per-region Age Assurance configuration.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#configRegion",
),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("configRegion"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"The Age Assurance configuration for a specific region.",
),
),
required: Some(
vec![
SmolStr::new_static("countryCode"),
SmolStr::new_static("minAccessAge"),
SmolStr::new_static("rules")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("countryCode"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The ISO 3166-1 alpha-2 country code this configuration applies to.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("minAccessAge"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("regionCode"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("rules"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"The ordered list of Age Assurance rules that apply to this region. Rules should be applied in order, and the first matching rule determines the access level granted. The rules array should always include a default rule as the last item.",
),
),
items: LexArrayItem::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#configRegionRuleDefault"),
CowStr::new_static("#configRegionRuleIfDeclaredOverAge"),
CowStr::new_static("#configRegionRuleIfDeclaredUnderAge"),
CowStr::new_static("#configRegionRuleIfAssuredOverAge"),
CowStr::new_static("#configRegionRuleIfAssuredUnderAge"),
CowStr::new_static("#configRegionRuleIfAccountNewerThan"),
CowStr::new_static("#configRegionRuleIfAccountOlderThan")
],
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("configRegionRuleDefault"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("Age Assurance rule that applies by default."),
),
required: Some(vec![SmolStr::new_static("access")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#access",
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("configRegionRuleIfAccountNewerThan"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Age Assurance rule that applies if the account is equal-to or newer than a certain date.",
),
),
required: Some(
vec![SmolStr::new_static("date"), SmolStr::new_static("access")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#access",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("date"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The date threshold as a datetime string.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("configRegionRuleIfAccountOlderThan"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Age Assurance rule that applies if the account is older than a certain date.",
),
),
required: Some(
vec![SmolStr::new_static("date"), SmolStr::new_static("access")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#access",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("date"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The date threshold as a datetime string.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("configRegionRuleIfAssuredOverAge"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age.",
),
),
required: Some(
vec![SmolStr::new_static("age"), SmolStr::new_static("access")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#access",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("age"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("configRegionRuleIfAssuredUnderAge"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Age Assurance rule that applies if the user has been assured to be under a certain age.",
),
),
required: Some(
vec![SmolStr::new_static("age"), SmolStr::new_static("access")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#access",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("age"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("configRegionRuleIfDeclaredOverAge"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age.",
),
),
required: Some(
vec![SmolStr::new_static("age"), SmolStr::new_static("access")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#access",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("age"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("configRegionRuleIfDeclaredUnderAge"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Age Assurance rule that applies if the user has declared themselves under a certain age.",
),
),
required: Some(
vec![SmolStr::new_static("age"), SmolStr::new_static("access")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#access",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("age"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("event"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Object used to store Age Assurance data in stash.",
),
),
required: Some(
vec![
SmolStr::new_static("createdAt"),
SmolStr::new_static("status"), SmolStr::new_static("access"),
SmolStr::new_static("attemptId"),
SmolStr::new_static("countryCode")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The access level granted based on Age Assurance data we've processed.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("attemptId"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The unique identifier for this instance of the Age Assurance flow, in UUID format.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("completeIp"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The IP address used when completing the Age Assurance flow.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("completeUa"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The user agent used when completing the Age Assurance flow.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("countryCode"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The date and time of this write operation.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("email"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The email used for Age Assurance."),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("initIp"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The IP address used when initiating the Age Assurance flow.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("initUa"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The user agent used when initiating the Age Assurance flow.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("regionCode"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The ISO 3166-2 region code provided when beginning the Age Assurance flow.",
),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The status of the Age Assurance process.",
),
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("state"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("The user's computed Age Assurance state."),
),
required: Some(
vec![
SmolStr::new_static("status"), SmolStr::new_static("access")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("access"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#access",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lastInitiatedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The timestamp when this state was last updated.",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"app.bsky.ageassurance.defs#status",
),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("stateMetadata"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Additional metadata needed to compute Age Assurance state client-side.",
),
),
required: Some(vec![]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("accountCreatedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The account creation timestamp."),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("status"),
LexUserType::String(LexString {
description: Some(
CowStr::new_static("The status of the Age Assurance process."),
),
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod config_region_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 Rules;
type CountryCode;
type MinAccessAge;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Rules = Unset;
type CountryCode = Unset;
type MinAccessAge = Unset;
}
pub struct SetRules<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRules<S> {}
impl<S: State> State for SetRules<S> {
type Rules = Set<members::rules>;
type CountryCode = S::CountryCode;
type MinAccessAge = S::MinAccessAge;
}
pub struct SetCountryCode<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCountryCode<S> {}
impl<S: State> State for SetCountryCode<S> {
type Rules = S::Rules;
type CountryCode = Set<members::country_code>;
type MinAccessAge = S::MinAccessAge;
}
pub struct SetMinAccessAge<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetMinAccessAge<S> {}
impl<S: State> State for SetMinAccessAge<S> {
type Rules = S::Rules;
type CountryCode = S::CountryCode;
type MinAccessAge = Set<members::min_access_age>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct rules(());
pub struct country_code(());
pub struct min_access_age(());
}
}
pub struct ConfigRegionBuilder<'a, S: config_region_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<CowStr<'a>>,
Option<i64>,
Option<CowStr<'a>>,
Option<Vec<ConfigRegionRulesItem<'a>>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ConfigRegion<'a> {
pub fn new() -> ConfigRegionBuilder<'a, config_region_state::Empty> {
ConfigRegionBuilder::new()
}
}
impl<'a> ConfigRegionBuilder<'a, config_region_state::Empty> {
pub fn new() -> Self {
ConfigRegionBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionBuilder<'a, S>
where
S: config_region_state::State,
S::CountryCode: config_region_state::IsUnset,
{
pub fn country_code(
mut self,
value: impl Into<CowStr<'a>>,
) -> ConfigRegionBuilder<'a, config_region_state::SetCountryCode<S>> {
self._fields.0 = Option::Some(value.into());
ConfigRegionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionBuilder<'a, S>
where
S: config_region_state::State,
S::MinAccessAge: config_region_state::IsUnset,
{
pub fn min_access_age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionBuilder<'a, config_region_state::SetMinAccessAge<S>> {
self._fields.1 = Option::Some(value.into());
ConfigRegionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: config_region_state::State> ConfigRegionBuilder<'a, S> {
pub fn region_code(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_region_code(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> ConfigRegionBuilder<'a, S>
where
S: config_region_state::State,
S::Rules: config_region_state::IsUnset,
{
pub fn rules(
mut self,
value: impl Into<Vec<ConfigRegionRulesItem<'a>>>,
) -> ConfigRegionBuilder<'a, config_region_state::SetRules<S>> {
self._fields.3 = Option::Some(value.into());
ConfigRegionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionBuilder<'a, S>
where
S: config_region_state::State,
S::Rules: config_region_state::IsSet,
S::CountryCode: config_region_state::IsSet,
S::MinAccessAge: config_region_state::IsSet,
{
pub fn build(self) -> ConfigRegion<'a> {
ConfigRegion {
country_code: self._fields.0.unwrap(),
min_access_age: self._fields.1.unwrap(),
region_code: self._fields.2,
rules: self._fields.3.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>,
>,
) -> ConfigRegion<'a> {
ConfigRegion {
country_code: self._fields.0.unwrap(),
min_access_age: self._fields.1.unwrap(),
region_code: self._fields.2,
rules: self._fields.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod config_region_rule_default_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 Access;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Access = Unset;
}
pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAccess<S> {}
impl<S: State> State for SetAccess<S> {
type Access = Set<members::access>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
}
}
pub struct ConfigRegionRuleDefaultBuilder<
'a,
S: config_region_rule_default_state::State,
> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ageassurance::Access<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ConfigRegionRuleDefault<'a> {
pub fn new() -> ConfigRegionRuleDefaultBuilder<
'a,
config_region_rule_default_state::Empty,
> {
ConfigRegionRuleDefaultBuilder::new()
}
}
impl<'a> ConfigRegionRuleDefaultBuilder<'a, config_region_rule_default_state::Empty> {
pub fn new() -> Self {
ConfigRegionRuleDefaultBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleDefaultBuilder<'a, S>
where
S: config_region_rule_default_state::State,
S::Access: config_region_rule_default_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<'a>>,
) -> ConfigRegionRuleDefaultBuilder<
'a,
config_region_rule_default_state::SetAccess<S>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleDefaultBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleDefaultBuilder<'a, S>
where
S: config_region_rule_default_state::State,
S::Access: config_region_rule_default_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleDefault<'a> {
ConfigRegionRuleDefault {
access: self._fields.0.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>,
>,
) -> ConfigRegionRuleDefault<'a> {
ConfigRegionRuleDefault {
access: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod config_region_rule_if_account_newer_than_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 Access;
type Date;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Access = Unset;
type Date = Unset;
}
pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAccess<S> {}
impl<S: State> State for SetAccess<S> {
type Access = Set<members::access>;
type Date = S::Date;
}
pub struct SetDate<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDate<S> {}
impl<S: State> State for SetDate<S> {
type Access = S::Access;
type Date = Set<members::date>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct date(());
}
}
pub struct ConfigRegionRuleIfAccountNewerThanBuilder<
'a,
S: config_region_rule_if_account_newer_than_state::State,
> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ageassurance::Access<'a>>, Option<Datetime>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ConfigRegionRuleIfAccountNewerThan<'a> {
pub fn new() -> ConfigRegionRuleIfAccountNewerThanBuilder<
'a,
config_region_rule_if_account_newer_than_state::Empty,
> {
ConfigRegionRuleIfAccountNewerThanBuilder::new()
}
}
impl<
'a,
> ConfigRegionRuleIfAccountNewerThanBuilder<
'a,
config_region_rule_if_account_newer_than_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfAccountNewerThanBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S>
where
S: config_region_rule_if_account_newer_than_state::State,
S::Access: config_region_rule_if_account_newer_than_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<'a>>,
) -> ConfigRegionRuleIfAccountNewerThanBuilder<
'a,
config_region_rule_if_account_newer_than_state::SetAccess<S>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfAccountNewerThanBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S>
where
S: config_region_rule_if_account_newer_than_state::State,
S::Date: config_region_rule_if_account_newer_than_state::IsUnset,
{
pub fn date(
mut self,
value: impl Into<Datetime>,
) -> ConfigRegionRuleIfAccountNewerThanBuilder<
'a,
config_region_rule_if_account_newer_than_state::SetDate<S>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfAccountNewerThanBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAccountNewerThanBuilder<'a, S>
where
S: config_region_rule_if_account_newer_than_state::State,
S::Access: config_region_rule_if_account_newer_than_state::IsSet,
S::Date: config_region_rule_if_account_newer_than_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfAccountNewerThan<'a> {
ConfigRegionRuleIfAccountNewerThan {
access: self._fields.0.unwrap(),
date: self._fields.1.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>,
>,
) -> ConfigRegionRuleIfAccountNewerThan<'a> {
ConfigRegionRuleIfAccountNewerThan {
access: self._fields.0.unwrap(),
date: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod config_region_rule_if_account_older_than_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 Access;
type Date;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Access = Unset;
type Date = Unset;
}
pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAccess<S> {}
impl<S: State> State for SetAccess<S> {
type Access = Set<members::access>;
type Date = S::Date;
}
pub struct SetDate<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDate<S> {}
impl<S: State> State for SetDate<S> {
type Access = S::Access;
type Date = Set<members::date>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct date(());
}
}
pub struct ConfigRegionRuleIfAccountOlderThanBuilder<
'a,
S: config_region_rule_if_account_older_than_state::State,
> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ageassurance::Access<'a>>, Option<Datetime>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ConfigRegionRuleIfAccountOlderThan<'a> {
pub fn new() -> ConfigRegionRuleIfAccountOlderThanBuilder<
'a,
config_region_rule_if_account_older_than_state::Empty,
> {
ConfigRegionRuleIfAccountOlderThanBuilder::new()
}
}
impl<
'a,
> ConfigRegionRuleIfAccountOlderThanBuilder<
'a,
config_region_rule_if_account_older_than_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfAccountOlderThanBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S>
where
S: config_region_rule_if_account_older_than_state::State,
S::Access: config_region_rule_if_account_older_than_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<'a>>,
) -> ConfigRegionRuleIfAccountOlderThanBuilder<
'a,
config_region_rule_if_account_older_than_state::SetAccess<S>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfAccountOlderThanBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S>
where
S: config_region_rule_if_account_older_than_state::State,
S::Date: config_region_rule_if_account_older_than_state::IsUnset,
{
pub fn date(
mut self,
value: impl Into<Datetime>,
) -> ConfigRegionRuleIfAccountOlderThanBuilder<
'a,
config_region_rule_if_account_older_than_state::SetDate<S>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfAccountOlderThanBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAccountOlderThanBuilder<'a, S>
where
S: config_region_rule_if_account_older_than_state::State,
S::Access: config_region_rule_if_account_older_than_state::IsSet,
S::Date: config_region_rule_if_account_older_than_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfAccountOlderThan<'a> {
ConfigRegionRuleIfAccountOlderThan {
access: self._fields.0.unwrap(),
date: self._fields.1.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>,
>,
) -> ConfigRegionRuleIfAccountOlderThan<'a> {
ConfigRegionRuleIfAccountOlderThan {
access: self._fields.0.unwrap(),
date: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod config_region_rule_if_assured_over_age_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 Access;
type Age;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Access = Unset;
type Age = Unset;
}
pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAccess<S> {}
impl<S: State> State for SetAccess<S> {
type Access = Set<members::access>;
type Age = S::Age;
}
pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAge<S> {}
impl<S: State> State for SetAge<S> {
type Access = S::Access;
type Age = Set<members::age>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct age(());
}
}
pub struct ConfigRegionRuleIfAssuredOverAgeBuilder<
'a,
S: config_region_rule_if_assured_over_age_state::State,
> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ageassurance::Access<'a>>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ConfigRegionRuleIfAssuredOverAge<'a> {
pub fn new() -> ConfigRegionRuleIfAssuredOverAgeBuilder<
'a,
config_region_rule_if_assured_over_age_state::Empty,
> {
ConfigRegionRuleIfAssuredOverAgeBuilder::new()
}
}
impl<
'a,
> ConfigRegionRuleIfAssuredOverAgeBuilder<
'a,
config_region_rule_if_assured_over_age_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfAssuredOverAgeBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S>
where
S: config_region_rule_if_assured_over_age_state::State,
S::Access: config_region_rule_if_assured_over_age_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<'a>>,
) -> ConfigRegionRuleIfAssuredOverAgeBuilder<
'a,
config_region_rule_if_assured_over_age_state::SetAccess<S>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfAssuredOverAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S>
where
S: config_region_rule_if_assured_over_age_state::State,
S::Age: config_region_rule_if_assured_over_age_state::IsUnset,
{
pub fn age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionRuleIfAssuredOverAgeBuilder<
'a,
config_region_rule_if_assured_over_age_state::SetAge<S>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfAssuredOverAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAssuredOverAgeBuilder<'a, S>
where
S: config_region_rule_if_assured_over_age_state::State,
S::Access: config_region_rule_if_assured_over_age_state::IsSet,
S::Age: config_region_rule_if_assured_over_age_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfAssuredOverAge<'a> {
ConfigRegionRuleIfAssuredOverAge {
access: self._fields.0.unwrap(),
age: self._fields.1.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>,
>,
) -> ConfigRegionRuleIfAssuredOverAge<'a> {
ConfigRegionRuleIfAssuredOverAge {
access: self._fields.0.unwrap(),
age: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod config_region_rule_if_assured_under_age_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 Access;
type Age;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Access = Unset;
type Age = Unset;
}
pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAccess<S> {}
impl<S: State> State for SetAccess<S> {
type Access = Set<members::access>;
type Age = S::Age;
}
pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAge<S> {}
impl<S: State> State for SetAge<S> {
type Access = S::Access;
type Age = Set<members::age>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct age(());
}
}
pub struct ConfigRegionRuleIfAssuredUnderAgeBuilder<
'a,
S: config_region_rule_if_assured_under_age_state::State,
> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ageassurance::Access<'a>>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ConfigRegionRuleIfAssuredUnderAge<'a> {
pub fn new() -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
'a,
config_region_rule_if_assured_under_age_state::Empty,
> {
ConfigRegionRuleIfAssuredUnderAgeBuilder::new()
}
}
impl<
'a,
> ConfigRegionRuleIfAssuredUnderAgeBuilder<
'a,
config_region_rule_if_assured_under_age_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfAssuredUnderAgeBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S>
where
S: config_region_rule_if_assured_under_age_state::State,
S::Access: config_region_rule_if_assured_under_age_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<'a>>,
) -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
'a,
config_region_rule_if_assured_under_age_state::SetAccess<S>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfAssuredUnderAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S>
where
S: config_region_rule_if_assured_under_age_state::State,
S::Age: config_region_rule_if_assured_under_age_state::IsUnset,
{
pub fn age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
'a,
config_region_rule_if_assured_under_age_state::SetAge<S>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfAssuredUnderAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfAssuredUnderAgeBuilder<'a, S>
where
S: config_region_rule_if_assured_under_age_state::State,
S::Access: config_region_rule_if_assured_under_age_state::IsSet,
S::Age: config_region_rule_if_assured_under_age_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfAssuredUnderAge<'a> {
ConfigRegionRuleIfAssuredUnderAge {
access: self._fields.0.unwrap(),
age: self._fields.1.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>,
>,
) -> ConfigRegionRuleIfAssuredUnderAge<'a> {
ConfigRegionRuleIfAssuredUnderAge {
access: self._fields.0.unwrap(),
age: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod config_region_rule_if_declared_over_age_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 Access;
type Age;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Access = Unset;
type Age = Unset;
}
pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAccess<S> {}
impl<S: State> State for SetAccess<S> {
type Access = Set<members::access>;
type Age = S::Age;
}
pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAge<S> {}
impl<S: State> State for SetAge<S> {
type Access = S::Access;
type Age = Set<members::age>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct age(());
}
}
pub struct ConfigRegionRuleIfDeclaredOverAgeBuilder<
'a,
S: config_region_rule_if_declared_over_age_state::State,
> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ageassurance::Access<'a>>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ConfigRegionRuleIfDeclaredOverAge<'a> {
pub fn new() -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
'a,
config_region_rule_if_declared_over_age_state::Empty,
> {
ConfigRegionRuleIfDeclaredOverAgeBuilder::new()
}
}
impl<
'a,
> ConfigRegionRuleIfDeclaredOverAgeBuilder<
'a,
config_region_rule_if_declared_over_age_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfDeclaredOverAgeBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfDeclaredOverAgeBuilder<'a, S>
where
S: config_region_rule_if_declared_over_age_state::State,
S::Access: config_region_rule_if_declared_over_age_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<'a>>,
) -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
'a,
config_region_rule_if_declared_over_age_state::SetAccess<S>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfDeclaredOverAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfDeclaredOverAgeBuilder<'a, S>
where
S: config_region_rule_if_declared_over_age_state::State,
S::Age: config_region_rule_if_declared_over_age_state::IsUnset,
{
pub fn age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
'a,
config_region_rule_if_declared_over_age_state::SetAge<S>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfDeclaredOverAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfDeclaredOverAgeBuilder<'a, S>
where
S: config_region_rule_if_declared_over_age_state::State,
S::Access: config_region_rule_if_declared_over_age_state::IsSet,
S::Age: config_region_rule_if_declared_over_age_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfDeclaredOverAge<'a> {
ConfigRegionRuleIfDeclaredOverAge {
access: self._fields.0.unwrap(),
age: self._fields.1.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>,
>,
) -> ConfigRegionRuleIfDeclaredOverAge<'a> {
ConfigRegionRuleIfDeclaredOverAge {
access: self._fields.0.unwrap(),
age: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod config_region_rule_if_declared_under_age_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 Age;
type Access;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Age = Unset;
type Access = Unset;
}
pub struct SetAge<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAge<S> {}
impl<S: State> State for SetAge<S> {
type Age = Set<members::age>;
type Access = S::Access;
}
pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAccess<S> {}
impl<S: State> State for SetAccess<S> {
type Age = S::Age;
type Access = Set<members::access>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct age(());
pub struct access(());
}
}
pub struct ConfigRegionRuleIfDeclaredUnderAgeBuilder<
'a,
S: config_region_rule_if_declared_under_age_state::State,
> {
_state: PhantomData<fn() -> S>,
_fields: (Option<ageassurance::Access<'a>>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> ConfigRegionRuleIfDeclaredUnderAge<'a> {
pub fn new() -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
'a,
config_region_rule_if_declared_under_age_state::Empty,
> {
ConfigRegionRuleIfDeclaredUnderAgeBuilder::new()
}
}
impl<
'a,
> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
'a,
config_region_rule_if_declared_under_age_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfDeclaredUnderAgeBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S>
where
S: config_region_rule_if_declared_under_age_state::State,
S::Access: config_region_rule_if_declared_under_age_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<'a>>,
) -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
'a,
config_region_rule_if_declared_under_age_state::SetAccess<S>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfDeclaredUnderAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S>
where
S: config_region_rule_if_declared_under_age_state::State,
S::Age: config_region_rule_if_declared_under_age_state::IsUnset,
{
pub fn age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
'a,
config_region_rule_if_declared_under_age_state::SetAge<S>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfDeclaredUnderAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ConfigRegionRuleIfDeclaredUnderAgeBuilder<'a, S>
where
S: config_region_rule_if_declared_under_age_state::State,
S::Age: config_region_rule_if_declared_under_age_state::IsSet,
S::Access: config_region_rule_if_declared_under_age_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfDeclaredUnderAge<'a> {
ConfigRegionRuleIfDeclaredUnderAge {
access: self._fields.0.unwrap(),
age: self._fields.1.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>,
>,
) -> ConfigRegionRuleIfDeclaredUnderAge<'a> {
ConfigRegionRuleIfDeclaredUnderAge {
access: self._fields.0.unwrap(),
age: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod event_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 AttemptId;
type Access;
type CreatedAt;
type CountryCode;
type Status;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type AttemptId = Unset;
type Access = Unset;
type CreatedAt = Unset;
type CountryCode = Unset;
type Status = Unset;
}
pub struct SetAttemptId<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAttemptId<S> {}
impl<S: State> State for SetAttemptId<S> {
type AttemptId = Set<members::attempt_id>;
type Access = S::Access;
type CreatedAt = S::CreatedAt;
type CountryCode = S::CountryCode;
type Status = S::Status;
}
pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAccess<S> {}
impl<S: State> State for SetAccess<S> {
type AttemptId = S::AttemptId;
type Access = Set<members::access>;
type CreatedAt = S::CreatedAt;
type CountryCode = S::CountryCode;
type Status = S::Status;
}
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 AttemptId = S::AttemptId;
type Access = S::Access;
type CreatedAt = Set<members::created_at>;
type CountryCode = S::CountryCode;
type Status = S::Status;
}
pub struct SetCountryCode<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCountryCode<S> {}
impl<S: State> State for SetCountryCode<S> {
type AttemptId = S::AttemptId;
type Access = S::Access;
type CreatedAt = S::CreatedAt;
type CountryCode = Set<members::country_code>;
type Status = S::Status;
}
pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetStatus<S> {}
impl<S: State> State for SetStatus<S> {
type AttemptId = S::AttemptId;
type Access = S::Access;
type CreatedAt = S::CreatedAt;
type CountryCode = S::CountryCode;
type Status = Set<members::status>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct attempt_id(());
pub struct access(());
pub struct created_at(());
pub struct country_code(());
pub struct status(());
}
}
pub struct EventBuilder<'a, S: event_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<EventAccess<'a>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<Datetime>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<EventStatus<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Event<'a> {
pub fn new() -> EventBuilder<'a, event_state::Empty> {
EventBuilder::new()
}
}
impl<'a> EventBuilder<'a, event_state::Empty> {
pub fn new() -> Self {
EventBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> EventBuilder<'a, S>
where
S: event_state::State,
S::Access: event_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<EventAccess<'a>>,
) -> EventBuilder<'a, event_state::SetAccess<S>> {
self._fields.0 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EventBuilder<'a, S>
where
S: event_state::State,
S::AttemptId: event_state::IsUnset,
{
pub fn attempt_id(
mut self,
value: impl Into<CowStr<'a>>,
) -> EventBuilder<'a, event_state::SetAttemptId<S>> {
self._fields.1 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: event_state::State> EventBuilder<'a, S> {
pub fn complete_ip(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_complete_ip(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: event_state::State> EventBuilder<'a, S> {
pub fn complete_ua(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_complete_ua(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> EventBuilder<'a, S>
where
S: event_state::State,
S::CountryCode: event_state::IsUnset,
{
pub fn country_code(
mut self,
value: impl Into<CowStr<'a>>,
) -> EventBuilder<'a, event_state::SetCountryCode<S>> {
self._fields.4 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EventBuilder<'a, S>
where
S: event_state::State,
S::CreatedAt: event_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> EventBuilder<'a, event_state::SetCreatedAt<S>> {
self._fields.5 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: event_state::State> EventBuilder<'a, S> {
pub fn email(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_email(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.6 = value;
self
}
}
impl<'a, S: event_state::State> EventBuilder<'a, S> {
pub fn init_ip(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_init_ip(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.7 = value;
self
}
}
impl<'a, S: event_state::State> EventBuilder<'a, S> {
pub fn init_ua(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_init_ua(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.8 = value;
self
}
}
impl<'a, S: event_state::State> EventBuilder<'a, S> {
pub fn region_code(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_region_code(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.9 = value;
self
}
}
impl<'a, S> EventBuilder<'a, S>
where
S: event_state::State,
S::Status: event_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<EventStatus<'a>>,
) -> EventBuilder<'a, event_state::SetStatus<S>> {
self._fields.10 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> EventBuilder<'a, S>
where
S: event_state::State,
S::AttemptId: event_state::IsSet,
S::Access: event_state::IsSet,
S::CreatedAt: event_state::IsSet,
S::CountryCode: event_state::IsSet,
S::Status: event_state::IsSet,
{
pub fn build(self) -> Event<'a> {
Event {
access: self._fields.0.unwrap(),
attempt_id: self._fields.1.unwrap(),
complete_ip: self._fields.2,
complete_ua: self._fields.3,
country_code: self._fields.4.unwrap(),
created_at: self._fields.5.unwrap(),
email: self._fields.6,
init_ip: self._fields.7,
init_ua: self._fields.8,
region_code: self._fields.9,
status: self._fields.10.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>,
>,
) -> Event<'a> {
Event {
access: self._fields.0.unwrap(),
attempt_id: self._fields.1.unwrap(),
complete_ip: self._fields.2,
complete_ua: self._fields.3,
country_code: self._fields.4.unwrap(),
created_at: self._fields.5.unwrap(),
email: self._fields.6,
init_ip: self._fields.7,
init_ua: self._fields.8,
region_code: self._fields.9,
status: self._fields.10.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod state_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 Access;
type Status;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Access = Unset;
type Status = Unset;
}
pub struct SetAccess<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetAccess<S> {}
impl<S: State> State for SetAccess<S> {
type Access = Set<members::access>;
type Status = S::Status;
}
pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetStatus<S> {}
impl<S: State> State for SetStatus<S> {
type Access = S::Access;
type Status = Set<members::status>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct status(());
}
}
pub struct StateBuilder<'a, S: state_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<ageassurance::Access<'a>>,
Option<Datetime>,
Option<ageassurance::Status<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> State<'a> {
pub fn new() -> StateBuilder<'a, state_state::Empty> {
StateBuilder::new()
}
}
impl<'a> StateBuilder<'a, state_state::Empty> {
pub fn new() -> Self {
StateBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> StateBuilder<'a, S>
where
S: state_state::State,
S::Access: state_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<'a>>,
) -> StateBuilder<'a, state_state::SetAccess<S>> {
self._fields.0 = Option::Some(value.into());
StateBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: state_state::State> StateBuilder<'a, S> {
pub fn last_initiated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_last_initiated_at(mut self, value: Option<Datetime>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> StateBuilder<'a, S>
where
S: state_state::State,
S::Status: state_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<ageassurance::Status<'a>>,
) -> StateBuilder<'a, state_state::SetStatus<S>> {
self._fields.2 = Option::Some(value.into());
StateBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> StateBuilder<'a, S>
where
S: state_state::State,
S::Access: state_state::IsSet,
S::Status: state_state::IsSet,
{
pub fn build(self) -> State<'a> {
State {
access: self._fields.0.unwrap(),
last_initiated_at: self._fields.1,
status: 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>,
>,
) -> State<'a> {
State {
access: self._fields.0.unwrap(),
last_initiated_at: self._fields.1,
status: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}