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, BosStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Datetime;
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, 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<S: BosStr = DefaultStr> {
Unknown,
None,
Safe,
Full,
Other(S),
}
impl<S: BosStr> Access<S> {
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(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"unknown" => Self::Unknown,
"none" => Self::None,
"safe" => Self::Safe,
"full" => Self::Full,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> AsRef<str> for Access<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> core::fmt::Display for Access<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> Serialize for Access<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for Access<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr> jacquard_common::IntoStatic for Access<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = Access<S::Output>;
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()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Config<S: BosStr = DefaultStr> {
pub regions: Vec<ageassurance::ConfigRegion<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConfigRegion<S: BosStr = DefaultStr> {
pub country_code: S,
pub min_access_age: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub region_code: Option<S>,
pub rules: Vec<ConfigRegionRulesItem<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum ConfigRegionRulesItem<S: BosStr = DefaultStr> {
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleDefault")]
ConfigRegionRuleDefault(Box<ageassurance::ConfigRegionRuleDefault<S>>),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge")]
ConfigRegionRuleIfDeclaredOverAge(
Box<ageassurance::ConfigRegionRuleIfDeclaredOverAge<S>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge")]
ConfigRegionRuleIfDeclaredUnderAge(
Box<ageassurance::ConfigRegionRuleIfDeclaredUnderAge<S>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge")]
ConfigRegionRuleIfAssuredOverAge(
Box<ageassurance::ConfigRegionRuleIfAssuredOverAge<S>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge")]
ConfigRegionRuleIfAssuredUnderAge(
Box<ageassurance::ConfigRegionRuleIfAssuredUnderAge<S>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan")]
ConfigRegionRuleIfAccountNewerThan(
Box<ageassurance::ConfigRegionRuleIfAccountNewerThan<S>>,
),
#[serde(rename = "app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan")]
ConfigRegionRuleIfAccountOlderThan(
Box<ageassurance::ConfigRegionRuleIfAccountOlderThan<S>>,
),
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConfigRegionRuleDefault<S: BosStr = DefaultStr> {
pub access: ageassurance::Access<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConfigRegionRuleIfAccountNewerThan<S: BosStr = DefaultStr> {
pub access: ageassurance::Access<S>,
pub date: Datetime,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConfigRegionRuleIfAccountOlderThan<S: BosStr = DefaultStr> {
pub access: ageassurance::Access<S>,
pub date: Datetime,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConfigRegionRuleIfAssuredOverAge<S: BosStr = DefaultStr> {
pub access: ageassurance::Access<S>,
pub age: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConfigRegionRuleIfAssuredUnderAge<S: BosStr = DefaultStr> {
pub access: ageassurance::Access<S>,
pub age: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConfigRegionRuleIfDeclaredOverAge<S: BosStr = DefaultStr> {
pub access: ageassurance::Access<S>,
pub age: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConfigRegionRuleIfDeclaredUnderAge<S: BosStr = DefaultStr> {
pub access: ageassurance::Access<S>,
pub age: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Event<S: BosStr = DefaultStr> {
pub access: EventAccess<S>,
pub attempt_id: S,
#[serde(skip_serializing_if = "Option::is_none")]
pub complete_ip: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub complete_ua: Option<S>,
pub country_code: S,
pub created_at: Datetime,
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub init_ip: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub init_ua: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub region_code: Option<S>,
pub status: EventStatus<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EventAccess<S: BosStr = DefaultStr> {
Unknown,
None,
Safe,
Full,
Other(S),
}
impl<S: BosStr> EventAccess<S> {
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(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"unknown" => Self::Unknown,
"none" => Self::None,
"safe" => Self::Safe,
"full" => Self::Full,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for EventAccess<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for EventAccess<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for EventAccess<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for EventAccess<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for EventAccess<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for EventAccess<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = EventAccess<S::Output>;
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<S: BosStr = DefaultStr> {
Unknown,
Pending,
Assured,
Blocked,
Other(S),
}
impl<S: BosStr> EventStatus<S> {
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(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"unknown" => Self::Unknown,
"pending" => Self::Pending,
"assured" => Self::Assured,
"blocked" => Self::Blocked,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for EventStatus<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for EventStatus<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for EventStatus<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for EventStatus<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for EventStatus<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for EventStatus<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = EventStatus<S::Output>;
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()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct State<S: BosStr = DefaultStr> {
pub access: ageassurance::Access<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_initiated_at: Option<Datetime>,
pub status: ageassurance::Status<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct StateMetadata<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub account_created_at: Option<Datetime>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Status<S: BosStr = DefaultStr> {
Unknown,
Pending,
Assured,
Blocked,
Other(S),
}
impl<S: BosStr> Status<S> {
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(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"unknown" => Self::Unknown,
"pending" => Self::Pending,
"assured" => Self::Assured,
"blocked" => Self::Blocked,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> AsRef<str> for Status<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> core::fmt::Display for Status<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> Serialize for Status<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for Status<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr> jacquard_common::IntoStatic for Status<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = Status<S::Output>;
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<S: BosStr> LexiconSchema for Config<S> {
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<S: BosStr> LexiconSchema for ConfigRegion<S> {
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<S: BosStr> LexiconSchema for ConfigRegionRuleDefault<S> {
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<S: BosStr> LexiconSchema for ConfigRegionRuleIfAccountNewerThan<S> {
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<S: BosStr> LexiconSchema for ConfigRegionRuleIfAccountOlderThan<S> {
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<S: BosStr> LexiconSchema for ConfigRegionRuleIfAssuredOverAge<S> {
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<S: BosStr> LexiconSchema for ConfigRegionRuleIfAssuredUnderAge<S> {
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<S: BosStr> LexiconSchema for ConfigRegionRuleIfDeclaredOverAge<S> {
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<S: BosStr> LexiconSchema for ConfigRegionRuleIfDeclaredUnderAge<S> {
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<S: BosStr> LexiconSchema for Event<S> {
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<S: BosStr> LexiconSchema for State<S> {
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<S: BosStr> LexiconSchema for StateMetadata<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRegions<St> {}
impl<St: State> State for SetRegions<St> {
type Regions = Set<members::regions>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct regions(());
}
}
pub struct ConfigBuilder<S: BosStr, St: config_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Vec<ageassurance::ConfigRegion<S>>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Config<S> {
pub fn new() -> ConfigBuilder<S, config_state::Empty> {
ConfigBuilder::new()
}
}
impl<S: BosStr> ConfigBuilder<S, config_state::Empty> {
pub fn new() -> Self {
ConfigBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigBuilder<S, St>
where
St: config_state::State,
St::Regions: config_state::IsUnset,
{
pub fn regions(
mut self,
value: impl Into<Vec<ageassurance::ConfigRegion<S>>>,
) -> ConfigBuilder<S, config_state::SetRegions<St>> {
self._fields.0 = Option::Some(value.into());
ConfigBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigBuilder<S, St>
where
St: config_state::State,
St::Regions: config_state::IsSet,
{
pub fn build(self) -> Config<S> {
Config {
regions: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Config<S> {
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 CountryCode;
type Rules;
type MinAccessAge;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CountryCode = Unset;
type Rules = Unset;
type MinAccessAge = Unset;
}
pub struct SetCountryCode<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCountryCode<St> {}
impl<St: State> State for SetCountryCode<St> {
type CountryCode = Set<members::country_code>;
type Rules = St::Rules;
type MinAccessAge = St::MinAccessAge;
}
pub struct SetRules<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRules<St> {}
impl<St: State> State for SetRules<St> {
type CountryCode = St::CountryCode;
type Rules = Set<members::rules>;
type MinAccessAge = St::MinAccessAge;
}
pub struct SetMinAccessAge<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetMinAccessAge<St> {}
impl<St: State> State for SetMinAccessAge<St> {
type CountryCode = St::CountryCode;
type Rules = St::Rules;
type MinAccessAge = Set<members::min_access_age>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct country_code(());
pub struct rules(());
pub struct min_access_age(());
}
}
pub struct ConfigRegionBuilder<S: BosStr, St: config_region_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<i64>, Option<S>, Option<Vec<ConfigRegionRulesItem<S>>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ConfigRegion<S> {
pub fn new() -> ConfigRegionBuilder<S, config_region_state::Empty> {
ConfigRegionBuilder::new()
}
}
impl<S: BosStr> ConfigRegionBuilder<S, config_region_state::Empty> {
pub fn new() -> Self {
ConfigRegionBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionBuilder<S, St>
where
St: config_region_state::State,
St::CountryCode: config_region_state::IsUnset,
{
pub fn country_code(
mut self,
value: impl Into<S>,
) -> ConfigRegionBuilder<S, config_region_state::SetCountryCode<St>> {
self._fields.0 = Option::Some(value.into());
ConfigRegionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionBuilder<S, St>
where
St: config_region_state::State,
St::MinAccessAge: config_region_state::IsUnset,
{
pub fn min_access_age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionBuilder<S, config_region_state::SetMinAccessAge<St>> {
self._fields.1 = Option::Some(value.into());
ConfigRegionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: config_region_state::State> ConfigRegionBuilder<S, St> {
pub fn region_code(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_region_code(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> ConfigRegionBuilder<S, St>
where
St: config_region_state::State,
St::Rules: config_region_state::IsUnset,
{
pub fn rules(
mut self,
value: impl Into<Vec<ConfigRegionRulesItem<S>>>,
) -> ConfigRegionBuilder<S, config_region_state::SetRules<St>> {
self._fields.3 = Option::Some(value.into());
ConfigRegionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionBuilder<S, St>
where
St: config_region_state::State,
St::CountryCode: config_region_state::IsSet,
St::Rules: config_region_state::IsSet,
St::MinAccessAge: config_region_state::IsSet,
{
pub fn build(self) -> ConfigRegion<S> {
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<SmolStr, Data<S>>,
) -> ConfigRegion<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAccess<St> {}
impl<St: State> State for SetAccess<St> {
type Access = Set<members::access>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
}
}
pub struct ConfigRegionRuleDefaultBuilder<
S: BosStr,
St: config_region_rule_default_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ageassurance::Access<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ConfigRegionRuleDefault<S> {
pub fn new() -> ConfigRegionRuleDefaultBuilder<
S,
config_region_rule_default_state::Empty,
> {
ConfigRegionRuleDefaultBuilder::new()
}
}
impl<
S: BosStr,
> ConfigRegionRuleDefaultBuilder<S, config_region_rule_default_state::Empty> {
pub fn new() -> Self {
ConfigRegionRuleDefaultBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleDefaultBuilder<S, St>
where
St: config_region_rule_default_state::State,
St::Access: config_region_rule_default_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<S>>,
) -> ConfigRegionRuleDefaultBuilder<
S,
config_region_rule_default_state::SetAccess<St>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleDefaultBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleDefaultBuilder<S, St>
where
St: config_region_rule_default_state::State,
St::Access: config_region_rule_default_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleDefault<S> {
ConfigRegionRuleDefault {
access: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ConfigRegionRuleDefault<S> {
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 Date;
type Access;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Date = Unset;
type Access = Unset;
}
pub struct SetDate<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDate<St> {}
impl<St: State> State for SetDate<St> {
type Date = Set<members::date>;
type Access = St::Access;
}
pub struct SetAccess<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAccess<St> {}
impl<St: State> State for SetAccess<St> {
type Date = St::Date;
type Access = Set<members::access>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct date(());
pub struct access(());
}
}
pub struct ConfigRegionRuleIfAccountNewerThanBuilder<
S: BosStr,
St: config_region_rule_if_account_newer_than_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ageassurance::Access<S>>, Option<Datetime>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ConfigRegionRuleIfAccountNewerThan<S> {
pub fn new() -> ConfigRegionRuleIfAccountNewerThanBuilder<
S,
config_region_rule_if_account_newer_than_state::Empty,
> {
ConfigRegionRuleIfAccountNewerThanBuilder::new()
}
}
impl<
S: BosStr,
> ConfigRegionRuleIfAccountNewerThanBuilder<
S,
config_region_rule_if_account_newer_than_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfAccountNewerThanBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAccountNewerThanBuilder<S, St>
where
St: config_region_rule_if_account_newer_than_state::State,
St::Access: config_region_rule_if_account_newer_than_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<S>>,
) -> ConfigRegionRuleIfAccountNewerThanBuilder<
S,
config_region_rule_if_account_newer_than_state::SetAccess<St>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfAccountNewerThanBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAccountNewerThanBuilder<S, St>
where
St: config_region_rule_if_account_newer_than_state::State,
St::Date: config_region_rule_if_account_newer_than_state::IsUnset,
{
pub fn date(
mut self,
value: impl Into<Datetime>,
) -> ConfigRegionRuleIfAccountNewerThanBuilder<
S,
config_region_rule_if_account_newer_than_state::SetDate<St>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfAccountNewerThanBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAccountNewerThanBuilder<S, St>
where
St: config_region_rule_if_account_newer_than_state::State,
St::Date: config_region_rule_if_account_newer_than_state::IsSet,
St::Access: config_region_rule_if_account_newer_than_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfAccountNewerThan<S> {
ConfigRegionRuleIfAccountNewerThan {
access: self._fields.0.unwrap(),
date: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ConfigRegionRuleIfAccountNewerThan<S> {
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 Date;
type Access;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Date = Unset;
type Access = Unset;
}
pub struct SetDate<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDate<St> {}
impl<St: State> State for SetDate<St> {
type Date = Set<members::date>;
type Access = St::Access;
}
pub struct SetAccess<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAccess<St> {}
impl<St: State> State for SetAccess<St> {
type Date = St::Date;
type Access = Set<members::access>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct date(());
pub struct access(());
}
}
pub struct ConfigRegionRuleIfAccountOlderThanBuilder<
S: BosStr,
St: config_region_rule_if_account_older_than_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ageassurance::Access<S>>, Option<Datetime>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ConfigRegionRuleIfAccountOlderThan<S> {
pub fn new() -> ConfigRegionRuleIfAccountOlderThanBuilder<
S,
config_region_rule_if_account_older_than_state::Empty,
> {
ConfigRegionRuleIfAccountOlderThanBuilder::new()
}
}
impl<
S: BosStr,
> ConfigRegionRuleIfAccountOlderThanBuilder<
S,
config_region_rule_if_account_older_than_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfAccountOlderThanBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAccountOlderThanBuilder<S, St>
where
St: config_region_rule_if_account_older_than_state::State,
St::Access: config_region_rule_if_account_older_than_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<S>>,
) -> ConfigRegionRuleIfAccountOlderThanBuilder<
S,
config_region_rule_if_account_older_than_state::SetAccess<St>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfAccountOlderThanBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAccountOlderThanBuilder<S, St>
where
St: config_region_rule_if_account_older_than_state::State,
St::Date: config_region_rule_if_account_older_than_state::IsUnset,
{
pub fn date(
mut self,
value: impl Into<Datetime>,
) -> ConfigRegionRuleIfAccountOlderThanBuilder<
S,
config_region_rule_if_account_older_than_state::SetDate<St>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfAccountOlderThanBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAccountOlderThanBuilder<S, St>
where
St: config_region_rule_if_account_older_than_state::State,
St::Date: config_region_rule_if_account_older_than_state::IsSet,
St::Access: config_region_rule_if_account_older_than_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfAccountOlderThan<S> {
ConfigRegionRuleIfAccountOlderThan {
access: self._fields.0.unwrap(),
date: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ConfigRegionRuleIfAccountOlderThan<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAccess<St> {}
impl<St: State> State for SetAccess<St> {
type Access = Set<members::access>;
type Age = St::Age;
}
pub struct SetAge<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAge<St> {}
impl<St: State> State for SetAge<St> {
type Access = St::Access;
type Age = Set<members::age>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct age(());
}
}
pub struct ConfigRegionRuleIfAssuredOverAgeBuilder<
S: BosStr,
St: config_region_rule_if_assured_over_age_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ageassurance::Access<S>>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ConfigRegionRuleIfAssuredOverAge<S> {
pub fn new() -> ConfigRegionRuleIfAssuredOverAgeBuilder<
S,
config_region_rule_if_assured_over_age_state::Empty,
> {
ConfigRegionRuleIfAssuredOverAgeBuilder::new()
}
}
impl<
S: BosStr,
> ConfigRegionRuleIfAssuredOverAgeBuilder<
S,
config_region_rule_if_assured_over_age_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfAssuredOverAgeBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAssuredOverAgeBuilder<S, St>
where
St: config_region_rule_if_assured_over_age_state::State,
St::Access: config_region_rule_if_assured_over_age_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<S>>,
) -> ConfigRegionRuleIfAssuredOverAgeBuilder<
S,
config_region_rule_if_assured_over_age_state::SetAccess<St>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfAssuredOverAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAssuredOverAgeBuilder<S, St>
where
St: config_region_rule_if_assured_over_age_state::State,
St::Age: config_region_rule_if_assured_over_age_state::IsUnset,
{
pub fn age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionRuleIfAssuredOverAgeBuilder<
S,
config_region_rule_if_assured_over_age_state::SetAge<St>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfAssuredOverAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAssuredOverAgeBuilder<S, St>
where
St: config_region_rule_if_assured_over_age_state::State,
St::Access: config_region_rule_if_assured_over_age_state::IsSet,
St::Age: config_region_rule_if_assured_over_age_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfAssuredOverAge<S> {
ConfigRegionRuleIfAssuredOverAge {
access: self._fields.0.unwrap(),
age: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ConfigRegionRuleIfAssuredOverAge<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAccess<St> {}
impl<St: State> State for SetAccess<St> {
type Access = Set<members::access>;
type Age = St::Age;
}
pub struct SetAge<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAge<St> {}
impl<St: State> State for SetAge<St> {
type Access = St::Access;
type Age = Set<members::age>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct age(());
}
}
pub struct ConfigRegionRuleIfAssuredUnderAgeBuilder<
S: BosStr,
St: config_region_rule_if_assured_under_age_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ageassurance::Access<S>>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ConfigRegionRuleIfAssuredUnderAge<S> {
pub fn new() -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
S,
config_region_rule_if_assured_under_age_state::Empty,
> {
ConfigRegionRuleIfAssuredUnderAgeBuilder::new()
}
}
impl<
S: BosStr,
> ConfigRegionRuleIfAssuredUnderAgeBuilder<
S,
config_region_rule_if_assured_under_age_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfAssuredUnderAgeBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAssuredUnderAgeBuilder<S, St>
where
St: config_region_rule_if_assured_under_age_state::State,
St::Access: config_region_rule_if_assured_under_age_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<S>>,
) -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
S,
config_region_rule_if_assured_under_age_state::SetAccess<St>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfAssuredUnderAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAssuredUnderAgeBuilder<S, St>
where
St: config_region_rule_if_assured_under_age_state::State,
St::Age: config_region_rule_if_assured_under_age_state::IsUnset,
{
pub fn age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionRuleIfAssuredUnderAgeBuilder<
S,
config_region_rule_if_assured_under_age_state::SetAge<St>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfAssuredUnderAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfAssuredUnderAgeBuilder<S, St>
where
St: config_region_rule_if_assured_under_age_state::State,
St::Access: config_region_rule_if_assured_under_age_state::IsSet,
St::Age: config_region_rule_if_assured_under_age_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfAssuredUnderAge<S> {
ConfigRegionRuleIfAssuredUnderAge {
access: self._fields.0.unwrap(),
age: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ConfigRegionRuleIfAssuredUnderAge<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAccess<St> {}
impl<St: State> State for SetAccess<St> {
type Access = Set<members::access>;
type Age = St::Age;
}
pub struct SetAge<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAge<St> {}
impl<St: State> State for SetAge<St> {
type Access = St::Access;
type Age = Set<members::age>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct age(());
}
}
pub struct ConfigRegionRuleIfDeclaredOverAgeBuilder<
S: BosStr,
St: config_region_rule_if_declared_over_age_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ageassurance::Access<S>>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ConfigRegionRuleIfDeclaredOverAge<S> {
pub fn new() -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
S,
config_region_rule_if_declared_over_age_state::Empty,
> {
ConfigRegionRuleIfDeclaredOverAgeBuilder::new()
}
}
impl<
S: BosStr,
> ConfigRegionRuleIfDeclaredOverAgeBuilder<
S,
config_region_rule_if_declared_over_age_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfDeclaredOverAgeBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfDeclaredOverAgeBuilder<S, St>
where
St: config_region_rule_if_declared_over_age_state::State,
St::Access: config_region_rule_if_declared_over_age_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<S>>,
) -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
S,
config_region_rule_if_declared_over_age_state::SetAccess<St>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfDeclaredOverAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfDeclaredOverAgeBuilder<S, St>
where
St: config_region_rule_if_declared_over_age_state::State,
St::Age: config_region_rule_if_declared_over_age_state::IsUnset,
{
pub fn age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionRuleIfDeclaredOverAgeBuilder<
S,
config_region_rule_if_declared_over_age_state::SetAge<St>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfDeclaredOverAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfDeclaredOverAgeBuilder<S, St>
where
St: config_region_rule_if_declared_over_age_state::State,
St::Access: config_region_rule_if_declared_over_age_state::IsSet,
St::Age: config_region_rule_if_declared_over_age_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfDeclaredOverAge<S> {
ConfigRegionRuleIfDeclaredOverAge {
access: self._fields.0.unwrap(),
age: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ConfigRegionRuleIfDeclaredOverAge<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAge<St> {}
impl<St: State> State for SetAge<St> {
type Age = Set<members::age>;
type Access = St::Access;
}
pub struct SetAccess<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAccess<St> {}
impl<St: State> State for SetAccess<St> {
type Age = St::Age;
type Access = Set<members::access>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct age(());
pub struct access(());
}
}
pub struct ConfigRegionRuleIfDeclaredUnderAgeBuilder<
S: BosStr,
St: config_region_rule_if_declared_under_age_state::State,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<ageassurance::Access<S>>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ConfigRegionRuleIfDeclaredUnderAge<S> {
pub fn new() -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
S,
config_region_rule_if_declared_under_age_state::Empty,
> {
ConfigRegionRuleIfDeclaredUnderAgeBuilder::new()
}
}
impl<
S: BosStr,
> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
S,
config_region_rule_if_declared_under_age_state::Empty,
> {
pub fn new() -> Self {
ConfigRegionRuleIfDeclaredUnderAgeBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfDeclaredUnderAgeBuilder<S, St>
where
St: config_region_rule_if_declared_under_age_state::State,
St::Access: config_region_rule_if_declared_under_age_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<S>>,
) -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
S,
config_region_rule_if_declared_under_age_state::SetAccess<St>,
> {
self._fields.0 = Option::Some(value.into());
ConfigRegionRuleIfDeclaredUnderAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfDeclaredUnderAgeBuilder<S, St>
where
St: config_region_rule_if_declared_under_age_state::State,
St::Age: config_region_rule_if_declared_under_age_state::IsUnset,
{
pub fn age(
mut self,
value: impl Into<i64>,
) -> ConfigRegionRuleIfDeclaredUnderAgeBuilder<
S,
config_region_rule_if_declared_under_age_state::SetAge<St>,
> {
self._fields.1 = Option::Some(value.into());
ConfigRegionRuleIfDeclaredUnderAgeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ConfigRegionRuleIfDeclaredUnderAgeBuilder<S, St>
where
St: config_region_rule_if_declared_under_age_state::State,
St::Age: config_region_rule_if_declared_under_age_state::IsSet,
St::Access: config_region_rule_if_declared_under_age_state::IsSet,
{
pub fn build(self) -> ConfigRegionRuleIfDeclaredUnderAge<S> {
ConfigRegionRuleIfDeclaredUnderAge {
access: self._fields.0.unwrap(),
age: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> ConfigRegionRuleIfDeclaredUnderAge<S> {
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 CountryCode;
type Status;
type CreatedAt;
type Access;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type AttemptId = Unset;
type CountryCode = Unset;
type Status = Unset;
type CreatedAt = Unset;
type Access = Unset;
}
pub struct SetAttemptId<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAttemptId<St> {}
impl<St: State> State for SetAttemptId<St> {
type AttemptId = Set<members::attempt_id>;
type CountryCode = St::CountryCode;
type Status = St::Status;
type CreatedAt = St::CreatedAt;
type Access = St::Access;
}
pub struct SetCountryCode<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCountryCode<St> {}
impl<St: State> State for SetCountryCode<St> {
type AttemptId = St::AttemptId;
type CountryCode = Set<members::country_code>;
type Status = St::Status;
type CreatedAt = St::CreatedAt;
type Access = St::Access;
}
pub struct SetStatus<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStatus<St> {}
impl<St: State> State for SetStatus<St> {
type AttemptId = St::AttemptId;
type CountryCode = St::CountryCode;
type Status = Set<members::status>;
type CreatedAt = St::CreatedAt;
type Access = St::Access;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type AttemptId = St::AttemptId;
type CountryCode = St::CountryCode;
type Status = St::Status;
type CreatedAt = Set<members::created_at>;
type Access = St::Access;
}
pub struct SetAccess<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAccess<St> {}
impl<St: State> State for SetAccess<St> {
type AttemptId = St::AttemptId;
type CountryCode = St::CountryCode;
type Status = St::Status;
type CreatedAt = St::CreatedAt;
type Access = Set<members::access>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct attempt_id(());
pub struct country_code(());
pub struct status(());
pub struct created_at(());
pub struct access(());
}
}
pub struct EventBuilder<S: BosStr, St: event_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<EventAccess<S>>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<Datetime>,
Option<S>,
Option<S>,
Option<S>,
Option<S>,
Option<EventStatus<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Event<S> {
pub fn new() -> EventBuilder<S, event_state::Empty> {
EventBuilder::new()
}
}
impl<S: BosStr> EventBuilder<S, event_state::Empty> {
pub fn new() -> Self {
EventBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None, None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::Access: event_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<EventAccess<S>>,
) -> EventBuilder<S, event_state::SetAccess<St>> {
self._fields.0 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::AttemptId: event_state::IsUnset,
{
pub fn attempt_id(
mut self,
value: impl Into<S>,
) -> EventBuilder<S, event_state::SetAttemptId<St>> {
self._fields.1 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn complete_ip(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_complete_ip(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn complete_ua(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_complete_ua(mut self, value: Option<S>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::CountryCode: event_state::IsUnset,
{
pub fn country_code(
mut self,
value: impl Into<S>,
) -> EventBuilder<S, event_state::SetCountryCode<St>> {
self._fields.4 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::CreatedAt: event_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> EventBuilder<S, event_state::SetCreatedAt<St>> {
self._fields.5 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn email(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.6 = value.into();
self
}
pub fn maybe_email(mut self, value: Option<S>) -> Self {
self._fields.6 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn init_ip(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.7 = value.into();
self
}
pub fn maybe_init_ip(mut self, value: Option<S>) -> Self {
self._fields.7 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn init_ua(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.8 = value.into();
self
}
pub fn maybe_init_ua(mut self, value: Option<S>) -> Self {
self._fields.8 = value;
self
}
}
impl<S: BosStr, St: event_state::State> EventBuilder<S, St> {
pub fn region_code(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.9 = value.into();
self
}
pub fn maybe_region_code(mut self, value: Option<S>) -> Self {
self._fields.9 = value;
self
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::Status: event_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<EventStatus<S>>,
) -> EventBuilder<S, event_state::SetStatus<St>> {
self._fields.10 = Option::Some(value.into());
EventBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> EventBuilder<S, St>
where
St: event_state::State,
St::AttemptId: event_state::IsSet,
St::CountryCode: event_state::IsSet,
St::Status: event_state::IsSet,
St::CreatedAt: event_state::IsSet,
St::Access: event_state::IsSet,
{
pub fn build(self) -> Event<S> {
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<SmolStr, Data<S>>) -> Event<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetAccess<St> {}
impl<St: State> State for SetAccess<St> {
type Access = Set<members::access>;
type Status = St::Status;
}
pub struct SetStatus<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStatus<St> {}
impl<St: State> State for SetStatus<St> {
type Access = St::Access;
type Status = Set<members::status>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct access(());
pub struct status(());
}
}
pub struct StateBuilder<S: BosStr, St: state_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<ageassurance::Access<S>>,
Option<Datetime>,
Option<ageassurance::Status<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> State<S> {
pub fn new() -> StateBuilder<S, state_state::Empty> {
StateBuilder::new()
}
}
impl<S: BosStr> StateBuilder<S, state_state::Empty> {
pub fn new() -> Self {
StateBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> StateBuilder<S, St>
where
St: state_state::State,
St::Access: state_state::IsUnset,
{
pub fn access(
mut self,
value: impl Into<ageassurance::Access<S>>,
) -> StateBuilder<S, state_state::SetAccess<St>> {
self._fields.0 = Option::Some(value.into());
StateBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: state_state::State> StateBuilder<S, St> {
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<S: BosStr, St> StateBuilder<S, St>
where
St: state_state::State,
St::Status: state_state::IsUnset,
{
pub fn status(
mut self,
value: impl Into<ageassurance::Status<S>>,
) -> StateBuilder<S, state_state::SetStatus<St>> {
self._fields.2 = Option::Some(value.into());
StateBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> StateBuilder<S, St>
where
St: state_state::State,
St::Access: state_state::IsSet,
St::Status: state_state::IsSet,
{
pub fn build(self) -> State<S> {
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<SmolStr, Data<S>>) -> State<S> {
State {
access: self._fields.0.unwrap(),
last_initiated_at: self._fields.1,
status: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}