// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.bsky.ageassurance.defs
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

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;
/// The access level granted based on Age Assurance data we've processed.

#[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> {
    ///The per-region Age Assurance configuration.
    #[serde(borrow)]
    pub regions: Vec<ageassurance::ConfigRegion<'a>>,
}

/// The Age Assurance configuration for a specific region.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegion<'a> {
    ///The ISO 3166-1 alpha-2 country code this configuration applies to.
    #[serde(borrow)]
    pub country_code: CowStr<'a>,
    ///The minimum age (as a whole integer) required to use Bluesky in this region.
    pub min_access_age: i64,
    ///The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub region_code: Option<CowStr<'a>>,
    ///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.
    #[serde(borrow)]
    pub rules: Vec<ConfigRegionRulesItem<'a>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(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>>,
    ),
}

/// Age Assurance rule that applies by default.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleDefault<'a> {
    #[serde(borrow)]
    pub access: ageassurance::Access<'a>,
}

/// Age Assurance rule that applies if the account is equal-to or newer than a certain date.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfAccountNewerThan<'a> {
    #[serde(borrow)]
    pub access: ageassurance::Access<'a>,
    ///The date threshold as a datetime string.
    pub date: Datetime,
}

/// Age Assurance rule that applies if the account is older than a certain date.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfAccountOlderThan<'a> {
    #[serde(borrow)]
    pub access: ageassurance::Access<'a>,
    ///The date threshold as a datetime string.
    pub date: Datetime,
}

/// Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfAssuredOverAge<'a> {
    #[serde(borrow)]
    pub access: ageassurance::Access<'a>,
    ///The age threshold as a whole integer.
    pub age: i64,
}

/// Age Assurance rule that applies if the user has been assured to be under a certain age.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfAssuredUnderAge<'a> {
    #[serde(borrow)]
    pub access: ageassurance::Access<'a>,
    ///The age threshold as a whole integer.
    pub age: i64,
}

/// Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfDeclaredOverAge<'a> {
    #[serde(borrow)]
    pub access: ageassurance::Access<'a>,
    ///The age threshold as a whole integer.
    pub age: i64,
}

/// Age Assurance rule that applies if the user has declared themselves under a certain age.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigRegionRuleIfDeclaredUnderAge<'a> {
    #[serde(borrow)]
    pub access: ageassurance::Access<'a>,
    ///The age threshold as a whole integer.
    pub age: i64,
}

/// Object used to store Age Assurance data in stash.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Event<'a> {
    ///The access level granted based on Age Assurance data we've processed.
    #[serde(borrow)]
    pub access: EventAccess<'a>,
    ///The unique identifier for this instance of the Age Assurance flow, in UUID format.
    #[serde(borrow)]
    pub attempt_id: CowStr<'a>,
    ///The IP address used when completing the Age Assurance flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub complete_ip: Option<CowStr<'a>>,
    ///The user agent used when completing the Age Assurance flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub complete_ua: Option<CowStr<'a>>,
    ///The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow.
    #[serde(borrow)]
    pub country_code: CowStr<'a>,
    ///The date and time of this write operation.
    pub created_at: Datetime,
    ///The email used for Age Assurance.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub email: Option<CowStr<'a>>,
    ///The IP address used when initiating the Age Assurance flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub init_ip: Option<CowStr<'a>>,
    ///The user agent used when initiating the Age Assurance flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub init_ua: Option<CowStr<'a>>,
    ///The ISO 3166-2 region code provided when beginning the Age Assurance flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub region_code: Option<CowStr<'a>>,
    ///The status of the Age Assurance process.
    #[serde(borrow)]
    pub status: EventStatus<'a>,
}

/// The access level granted based on Age Assurance data we've processed.

#[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()),
        }
    }
}

/// The status of the Age Assurance process.

#[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()),
        }
    }
}

/// The user's computed Age Assurance state.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct State<'a> {
    #[serde(borrow)]
    pub access: ageassurance::Access<'a>,
    ///The timestamp when this state was last updated.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_initiated_at: Option<Datetime>,
    #[serde(borrow)]
    pub status: ageassurance::Status<'a>,
}

/// Additional metadata needed to compute Age Assurance state client-side.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct StateMetadata<'a> {
    ///The account creation timestamp.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub account_created_at: Option<Datetime>,
}

/// The status of the Age Assurance process.

#[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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Regions;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Regions = Unset;
    }
    ///State transition - sets the `regions` field to Set
    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>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `regions` field
        pub struct regions(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    pub fn new() -> ConfigBuilder<'a, config_state::Empty> {
        ConfigBuilder::new()
    }
}

impl<'a> ConfigBuilder<'a, config_state::Empty> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `regions` field (required)
    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,
{
    /// Build the final struct
    pub fn build(self) -> Config<'a> {
        Config {
            regions: self._fields.0.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type MinAccessAge;
        type Rules;
        type CountryCode;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type MinAccessAge = Unset;
        type Rules = Unset;
        type CountryCode = Unset;
    }
    ///State transition - sets the `min_access_age` field to Set
    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 MinAccessAge = Set<members::min_access_age>;
        type Rules = S::Rules;
        type CountryCode = S::CountryCode;
    }
    ///State transition - sets the `rules` field to Set
    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 MinAccessAge = S::MinAccessAge;
        type Rules = Set<members::rules>;
        type CountryCode = S::CountryCode;
    }
    ///State transition - sets the `country_code` field to Set
    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 MinAccessAge = S::MinAccessAge;
        type Rules = S::Rules;
        type CountryCode = Set<members::country_code>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `min_access_age` field
        pub struct min_access_age(());
        ///Marker type for the `rules` field
        pub struct rules(());
        ///Marker type for the `country_code` field
        pub struct country_code(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    pub fn new() -> ConfigRegionBuilder<'a, config_region_state::Empty> {
        ConfigRegionBuilder::new()
    }
}

impl<'a> ConfigRegionBuilder<'a, config_region_state::Empty> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `countryCode` field (required)
    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,
{
    /// Set the `minAccessAge` field (required)
    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> {
    /// Set the `regionCode` field (optional)
    pub fn region_code(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `regionCode` field to an Option value (optional)
    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,
{
    /// Set the `rules` field (required)
    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::MinAccessAge: config_region_state::IsSet,
    S::Rules: config_region_state::IsSet,
    S::CountryCode: config_region_state::IsSet,
{
    /// Build the final struct
    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(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Access;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Access = Unset;
    }
    ///State transition - sets the `access` field to Set
    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>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `access` field
        pub struct access(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    pub fn new() -> ConfigRegionRuleDefaultBuilder<
        'a,
        config_region_rule_default_state::Empty,
    > {
        ConfigRegionRuleDefaultBuilder::new()
    }
}

impl<'a> ConfigRegionRuleDefaultBuilder<'a, config_region_rule_default_state::Empty> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `access` field (required)
    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,
{
    /// Build the final struct
    pub fn build(self) -> ConfigRegionRuleDefault<'a> {
        ConfigRegionRuleDefault {
            access: self._fields.0.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Access;
        type Date;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Access = Unset;
        type Date = Unset;
    }
    ///State transition - sets the `access` field to Set
    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;
    }
    ///State transition - sets the `date` field to Set
    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>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `access` field
        pub struct access(());
        ///Marker type for the `date` field
        pub struct date(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    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,
> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `access` field (required)
    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,
{
    /// Set the `date` field (required)
    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,
{
    /// Build the final struct
    pub fn build(self) -> ConfigRegionRuleIfAccountNewerThan<'a> {
        ConfigRegionRuleIfAccountNewerThan {
            access: self._fields.0.unwrap(),
            date: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Access;
        type Date;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Access = Unset;
        type Date = Unset;
    }
    ///State transition - sets the `access` field to Set
    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;
    }
    ///State transition - sets the `date` field to Set
    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>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `access` field
        pub struct access(());
        ///Marker type for the `date` field
        pub struct date(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    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,
> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `access` field (required)
    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,
{
    /// Set the `date` field (required)
    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,
{
    /// Build the final struct
    pub fn build(self) -> ConfigRegionRuleIfAccountOlderThan<'a> {
        ConfigRegionRuleIfAccountOlderThan {
            access: self._fields.0.unwrap(),
            date: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Age;
        type Access;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Age = Unset;
        type Access = Unset;
    }
    ///State transition - sets the `age` field to Set
    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;
    }
    ///State transition - sets the `access` field to Set
    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>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `age` field
        pub struct age(());
        ///Marker type for the `access` field
        pub struct access(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    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,
> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `access` field (required)
    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,
{
    /// Set the `age` field (required)
    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::Age: config_region_rule_if_assured_over_age_state::IsSet,
    S::Access: config_region_rule_if_assured_over_age_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ConfigRegionRuleIfAssuredOverAge<'a> {
        ConfigRegionRuleIfAssuredOverAge {
            access: self._fields.0.unwrap(),
            age: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Age;
        type Access;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Age = Unset;
        type Access = Unset;
    }
    ///State transition - sets the `age` field to Set
    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;
    }
    ///State transition - sets the `access` field to Set
    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>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `age` field
        pub struct age(());
        ///Marker type for the `access` field
        pub struct access(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    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,
> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `access` field (required)
    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,
{
    /// Set the `age` field (required)
    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::Age: config_region_rule_if_assured_under_age_state::IsSet,
    S::Access: config_region_rule_if_assured_under_age_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ConfigRegionRuleIfAssuredUnderAge<'a> {
        ConfigRegionRuleIfAssuredUnderAge {
            access: self._fields.0.unwrap(),
            age: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Access;
        type Age;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Access = Unset;
        type Age = Unset;
    }
    ///State transition - sets the `access` field to Set
    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;
    }
    ///State transition - sets the `age` field to Set
    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>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `access` field
        pub struct access(());
        ///Marker type for the `age` field
        pub struct age(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    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,
> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `access` field (required)
    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,
{
    /// Set the `age` field (required)
    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,
{
    /// Build the final struct
    pub fn build(self) -> ConfigRegionRuleIfDeclaredOverAge<'a> {
        ConfigRegionRuleIfDeclaredOverAge {
            access: self._fields.0.unwrap(),
            age: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Access;
        type Age;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Access = Unset;
        type Age = Unset;
    }
    ///State transition - sets the `access` field to Set
    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;
    }
    ///State transition - sets the `age` field to Set
    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>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `access` field
        pub struct access(());
        ///Marker type for the `age` field
        pub struct age(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    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,
> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `access` field (required)
    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,
{
    /// Set the `age` field (required)
    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::Access: config_region_rule_if_declared_under_age_state::IsSet,
    S::Age: config_region_rule_if_declared_under_age_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ConfigRegionRuleIfDeclaredUnderAge<'a> {
        ConfigRegionRuleIfDeclaredUnderAge {
            access: self._fields.0.unwrap(),
            age: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type CreatedAt;
        type Access;
        type AttemptId;
        type CountryCode;
        type Status;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type Access = Unset;
        type AttemptId = Unset;
        type CountryCode = Unset;
        type Status = Unset;
    }
    ///State transition - sets the `created_at` field to Set
    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 CreatedAt = Set<members::created_at>;
        type Access = S::Access;
        type AttemptId = S::AttemptId;
        type CountryCode = S::CountryCode;
        type Status = S::Status;
    }
    ///State transition - sets the `access` field to Set
    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 CreatedAt = S::CreatedAt;
        type Access = Set<members::access>;
        type AttemptId = S::AttemptId;
        type CountryCode = S::CountryCode;
        type Status = S::Status;
    }
    ///State transition - sets the `attempt_id` field to Set
    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 CreatedAt = S::CreatedAt;
        type Access = S::Access;
        type AttemptId = Set<members::attempt_id>;
        type CountryCode = S::CountryCode;
        type Status = S::Status;
    }
    ///State transition - sets the `country_code` field to Set
    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 CreatedAt = S::CreatedAt;
        type Access = S::Access;
        type AttemptId = S::AttemptId;
        type CountryCode = Set<members::country_code>;
        type Status = S::Status;
    }
    ///State transition - sets the `status` field to Set
    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 CreatedAt = S::CreatedAt;
        type Access = S::Access;
        type AttemptId = S::AttemptId;
        type CountryCode = S::CountryCode;
        type Status = Set<members::status>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `access` field
        pub struct access(());
        ///Marker type for the `attempt_id` field
        pub struct attempt_id(());
        ///Marker type for the `country_code` field
        pub struct country_code(());
        ///Marker type for the `status` field
        pub struct status(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    pub fn new() -> EventBuilder<'a, event_state::Empty> {
        EventBuilder::new()
    }
}

impl<'a> EventBuilder<'a, event_state::Empty> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `access` field (required)
    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,
{
    /// Set the `attemptId` field (required)
    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> {
    /// Set the `completeIp` field (optional)
    pub fn complete_ip(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `completeIp` field to an Option value (optional)
    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> {
    /// Set the `completeUa` field (optional)
    pub fn complete_ua(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `completeUa` field to an Option value (optional)
    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,
{
    /// Set the `countryCode` field (required)
    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,
{
    /// Set the `createdAt` field (required)
    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> {
    /// Set the `email` field (optional)
    pub fn email(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `email` field to an Option value (optional)
    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> {
    /// Set the `initIp` field (optional)
    pub fn init_ip(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `initIp` field to an Option value (optional)
    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> {
    /// Set the `initUa` field (optional)
    pub fn init_ua(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `initUa` field to an Option value (optional)
    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> {
    /// Set the `regionCode` field (optional)
    pub fn region_code(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `regionCode` field to an Option value (optional)
    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,
{
    /// Set the `status` field (required)
    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::CreatedAt: event_state::IsSet,
    S::Access: event_state::IsSet,
    S::AttemptId: event_state::IsSet,
    S::CountryCode: event_state::IsSet,
    S::Status: event_state::IsSet,
{
    /// Build the final struct
    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(),
        }
    }
    /// Build the final struct with custom extra_data
    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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Status;
        type Access;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Status = Unset;
        type Access = Unset;
    }
    ///State transition - sets the `status` field to Set
    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 Status = Set<members::status>;
        type Access = S::Access;
    }
    ///State transition - sets the `access` field to Set
    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 Status = S::Status;
        type Access = Set<members::access>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `status` field
        pub struct status(());
        ///Marker type for the `access` field
        pub struct access(());
    }
}

/// Builder for constructing an instance of this type
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> {
    /// Create a new builder for this type
    pub fn new() -> StateBuilder<'a, state_state::Empty> {
        StateBuilder::new()
    }
}

impl<'a> StateBuilder<'a, state_state::Empty> {
    /// Create a new builder with all fields unset
    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,
{
    /// Set the `access` field (required)
    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> {
    /// Set the `lastInitiatedAt` field (optional)
    pub fn last_initiated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `lastInitiatedAt` field to an Option value (optional)
    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,
{
    /// Set the `status` field (required)
    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::Status: state_state::IsSet,
    S::Access: state_state::IsSet,
{
    /// Build the final struct
    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(),
        }
    }
    /// Build the final struct with custom extra_data
    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),
        }
    }
}