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

#[allow(unused_imports)]
use alloc::collections::BTreeMap;

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::actor_rpg::stats;
/// The six ability scores (1-30 per SRD)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Abilities<S: BosStr = DefaultStr> {
    ///Charisma
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cha: Option<i64>,
    ///Constitution
    #[serde(skip_serializing_if = "Option::is_none")]
    pub con: Option<i64>,
    ///Dexterity
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dex: Option<i64>,
    ///Intelligence
    #[serde(skip_serializing_if = "Option::is_none")]
    pub int: Option<i64>,
    ///Strength
    #[serde(skip_serializing_if = "Option::is_none")]
    pub str: Option<i64>,
    ///Wisdom
    #[serde(skip_serializing_if = "Option::is_none")]
    pub wis: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// An attack action

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Attack<S: BosStr = DefaultStr> {
    ///Attack bonus (e.g., +5)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bonus: Option<S>,
    ///Damage dice (e.g., 1d8)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub damage: Option<S>,
    ///Damage bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub damage_bonus: Option<i64>,
    ///Damage type
    #[serde(skip_serializing_if = "Option::is_none")]
    pub damage_type: Option<S>,
    ///Attack name
    pub name: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Currency

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Coinage<S: BosStr = DefaultStr> {
    ///Copper pieces
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cp: Option<i64>,
    ///Electrum pieces
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ep: Option<i64>,
    ///Gold pieces
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gp: Option<i64>,
    ///Platinum pieces
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pp: Option<i64>,
    ///Silver pieces
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sp: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Combat and defensive stats

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Combat<S: BosStr = DefaultStr> {
    ///Armor Class
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ac: Option<i64>,
    ///Hit dice (e.g., 5d10)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hit_dice: Option<S>,
    ///Hit dice expended
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hit_dice_used: Option<i64>,
    ///Initiative modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub initiative: Option<i64>,
    ///Speed in feet
    #[serde(skip_serializing_if = "Option::is_none")]
    pub speed: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Status conditions and effects

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Conditions<S: BosStr = DefaultStr> {
    ///Death saving throw progress
    #[serde(skip_serializing_if = "Option::is_none")]
    pub death_saves: Option<stats::DeathSaves<S>>,
    ///Exhaustion level (0-6)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub exhaustion: Option<i64>,
    ///Has inspiration
    #[serde(skip_serializing_if = "Option::is_none")]
    pub inspiration: Option<bool>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A custom stat

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CustomStat<S: BosStr = DefaultStr> {
    ///Category (optional)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub category: Option<S>,
    ///Maximum (optional)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max: Option<i64>,
    ///Minimum (optional)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub min: Option<i64>,
    ///Stat name
    pub name: S,
    ///Value
    pub value: i64,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// User-defined custom stat system

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CustomStats<S: BosStr = DefaultStr> {
    ///Custom stat entries
    #[serde(skip_serializing_if = "Option::is_none")]
    pub stats: Option<Vec<stats::CustomStat<S>>>,
    ///System name
    #[serde(skip_serializing_if = "Option::is_none")]
    pub system_name: Option<S>,
    ///Version
    #[serde(skip_serializing_if = "Option::is_none")]
    pub system_version: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// DCC ability scores (3-18 standard, can be modified by corruption/spellburn)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccAbilities<S: BosStr = DefaultStr> {
    ///Agility
    #[serde(skip_serializing_if = "Option::is_none")]
    pub agi: Option<i64>,
    ///Agility base (before spellburn)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub agi_base: Option<i64>,
    ///Intelligence
    #[serde(skip_serializing_if = "Option::is_none")]
    pub int: Option<i64>,
    ///Luck (can be permanently burned)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub luk: Option<i64>,
    ///Personality
    #[serde(skip_serializing_if = "Option::is_none")]
    pub per: Option<i64>,
    ///Stamina
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sta: Option<i64>,
    ///Stamina base (before spellburn)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sta_base: Option<i64>,
    ///Strength
    #[serde(skip_serializing_if = "Option::is_none")]
    pub str: Option<i64>,
    ///Strength base (before spellburn)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub str_base: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A weapon attack (includes deed die for warriors)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccAttack<S: BosStr = DefaultStr> {
    ///Attack modifier (e.g., +2, d16+2 for deed die)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attack_mod: Option<S>,
    ///Damage dice (e.g., 1d8+2, 1d6+d3)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub damage: Option<S>,
    ///Damage bonus (e.g., +2, +d3 for deed die)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub damage_bonus: Option<S>,
    ///Weapon name
    pub name: S,
    ///Special properties (backstab, trained weapon, etc.)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub notes: Option<S>,
    ///Range (melee or distance)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub range: Option<S>,
    ///Attack type (melee, ranged, etc.)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#type: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Cleric spellcasting features

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccCleric<S: BosStr = DefaultStr> {
    ///Deity or supernatural patron
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deity: Option<S>,
    ///Current disapproval range (starts at 1, accumulates)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disapproval_range: Option<i64>,
    ///Deity-specific disapproval table if any
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disapproval_table: Option<S>,
    ///Holy symbol description
    #[serde(skip_serializing_if = "Option::is_none")]
    pub holy_symbol: Option<S>,
    ///Known cleric spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub known_spells: Option<Vec<stats::DccClericSpell<S>>>,
    ///Lay on hands die (e.g., d14, d16)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lay_on_hands_die: Option<S>,
    ///Highest spell level accessible
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_spell_level: Option<i64>,
    ///Spell check modifier (PER mod + level)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub spell_check_mod: Option<i64>,
    ///Turn unholy die (e.g., d14, d16)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub turn_unholy_die: Option<S>,
    ///Serves a Chaotic deity (unholy instead of holy)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub unholy: Option<bool>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A cleric spell

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccClericSpell<S: BosStr = DefaultStr> {
    ///Spell level
    pub level: i64,
    ///Spell name
    pub name: S,
    ///Additional spell notes
    #[serde(skip_serializing_if = "Option::is_none")]
    pub notes: Option<S>,
    ///Casting may cause additional disapproval
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sinful: Option<bool>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// DCC uses cp, sp, gp (10cp = 1sp, 10sp = 1gp)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccCoinage<S: BosStr = DefaultStr> {
    ///Copper pieces
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cp: Option<i64>,
    ///Gold pieces
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gp: Option<i64>,
    ///Silver pieces
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sp: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Combat statistics

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccCombat<S: BosStr = DefaultStr> {
    ///Armor Class (10 + armor + AGI mod + shield)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ac: Option<i64>,
    ///Primary action die (e.g., d20, d20+d14)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub action_die: Option<S>,
    ///Base attack modifier (level-based for non-warriors)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attack_mod: Option<i64>,
    ///Critical hit die (e.g., d8, d12, d14)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub crit_die: Option<S>,
    ///Critical hit table (I, II, III, IV, V)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub crit_table: Option<S>,
    ///Fumble die (typically d4 for 0-level, varies by armor)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub fumble_die: Option<S>,
    ///Initiative modifier (AGI mod)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub initiative: Option<i64>,
    ///Speed in feet (typically 30, Dwarves 20)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub speed: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A corruption effect from failed spell checks

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccCorruption<S: BosStr = DefaultStr> {
    ///Description of the corruption
    #[serde(skip_serializing_if = "Option::is_none")]
    pub effect: Option<S>,
    ///Whether this corruption is permanent
    #[serde(skip_serializing_if = "Option::is_none")]
    pub permanent: Option<bool>,
    ///What spell caused this corruption
    #[serde(skip_serializing_if = "Option::is_none")]
    pub source: Option<S>,
    ///Corruption severity (minor, major, greater)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#type: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Equipment and inventory

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccEquipment<S: BosStr = DefaultStr> {
    ///Armor worn (affects fumble die)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub armor: Option<S>,
    ///Armor check penalty (affects skills)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub armor_check_penalty: Option<i64>,
    ///Other equipment
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gear: Option<S>,
    ///Shield (if any)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub shield: Option<S>,
    ///Trade goods from occupation
    #[serde(skip_serializing_if = "Option::is_none")]
    pub trade_goods: Option<S>,
    ///Valuables and treasure
    #[serde(skip_serializing_if = "Option::is_none")]
    pub treasure: Option<S>,
    ///Weapons carried
    #[serde(skip_serializing_if = "Option::is_none")]
    pub weapons: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Halfling class features

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccHalfling<S: BosStr = DefaultStr> {
    ///Can spend luck to aid nearby allies
    #[serde(skip_serializing_if = "Option::is_none")]
    pub good_luck_charm: Option<bool>,
    ///Infravision range in feet (30)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub infravision: Option<i64>,
    ///Total luck points spent helping allies
    #[serde(skip_serializing_if = "Option::is_none")]
    pub luck_spent_on_allies: Option<i64>,
    ///Weapon type luck modifier applies to
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lucky_weapon: Option<S>,
    ///Bonus to sneak/hide when in natural environment
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sneak_and_hide: Option<i64>,
    ///Can dual-wield without penalty
    #[serde(skip_serializing_if = "Option::is_none")]
    pub two_weapon_fighting: Option<bool>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Hit points (0-level characters use 1d4 + STA mod)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccHp<S: BosStr = DefaultStr> {
    ///Current HP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub current: Option<i64>,
    ///Maximum HP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// DCC character identity and progression

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccIdentity<S: BosStr = DefaultStr> {
    ///Alignment (Lawful, Neutral, Chaotic)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alignment: Option<S>,
    ///Class (Warrior, Wizard, Cleric, Thief, Elf, Dwarf, Halfling)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub class: Option<S>,
    ///Character level (0 for funnel characters)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub level: Option<i64>,
    ///0-level occupation (e.g., Blacksmith, Farmer)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub occupation: Option<S>,
    ///Level title (e.g., Squire, Cutpurse, Acolyte)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<S>,
    ///Experience points
    #[serde(skip_serializing_if = "Option::is_none")]
    pub xp: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Birth augur and luck mechanics

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccLuck<S: BosStr = DefaultStr> {
    ///Birth augur name (e.g., Harsh Winter, The Bull, Fortunate Date)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub birth_augur: Option<S>,
    ///What the luck modifier applies to
    #[serde(skip_serializing_if = "Option::is_none")]
    pub birth_augur_effect: Option<S>,
    ///Weapon type that luck applies to (Dwarves/Halflings)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lucky_weapon: Option<S>,
    ///Starting luck score (for tracking burned luck)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub starting_luck: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// DCC saving throws (3 saves, not 6)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccSaves<S: BosStr = DefaultStr> {
    ///Fortitude save modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub fort: Option<i64>,
    ///Reflex save modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#ref: Option<i64>,
    ///Willpower save modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub will: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Current spellburn (temporary ability score sacrifice)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccSpellburn<S: BosStr = DefaultStr> {
    ///Agility points currently burned
    #[serde(skip_serializing_if = "Option::is_none")]
    pub agi_burned: Option<i64>,
    ///Points recovered per day
    #[serde(skip_serializing_if = "Option::is_none")]
    pub recovery_rate: Option<i64>,
    ///Stamina points currently burned
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sta_burned: Option<i64>,
    ///Strength points currently burned
    #[serde(skip_serializing_if = "Option::is_none")]
    pub str_burned: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Dungeon Crawl Classics RPG character sheet. Supports 0-level funnel characters through 10th level.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccStats<S: BosStr = DefaultStr> {
    ///The six ability scores (STR, AGI, STA, INT, PER, LUK)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub abilities: Option<stats::DccAbilities<S>>,
    ///Notes about special abilities, class features, and racial traits
    #[serde(skip_serializing_if = "Option::is_none")]
    pub abilities_notes: Option<S>,
    ///Weapon attacks
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attacks: Option<Vec<stats::DccAttack<S>>>,
    ///Cleric spellcasting (disapproval, turn unholy, lay on hands)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cleric: Option<stats::DccCleric<S>>,
    ///Currency (cp, sp, gp)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub coinage: Option<stats::DccCoinage<S>>,
    ///Combat stats (AC, speed, action die, initiative, crit die/table)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub combat: Option<stats::DccCombat<S>>,
    ///Gear, treasure, and trade goods
    #[serde(skip_serializing_if = "Option::is_none")]
    pub equipment: Option<stats::DccEquipment<S>>,
    ///Halfling luck-sharing and dual wielding
    #[serde(skip_serializing_if = "Option::is_none")]
    pub halfling: Option<stats::DccHalfling<S>>,
    ///Hit points
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hp: Option<stats::DccHp<S>>,
    ///Character identity (occupation, class, level, alignment)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub identity: Option<stats::DccIdentity<S>>,
    ///Languages known
    #[serde(skip_serializing_if = "Option::is_none")]
    pub languages: Option<S>,
    ///Birth augur and luck tracking
    #[serde(skip_serializing_if = "Option::is_none")]
    pub luck: Option<stats::DccLuck<S>>,
    ///Character notes, backstory, and special abilities
    #[serde(skip_serializing_if = "Option::is_none")]
    pub notes: Option<S>,
    ///Saving throws (Reflex, Fortitude, Willpower)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub saves: Option<stats::DccSaves<S>>,
    ///Thief skills and abilities
    #[serde(skip_serializing_if = "Option::is_none")]
    pub thief: Option<stats::DccThief<S>>,
    ///Warrior/Dwarf class features (deed die, mighty deeds)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub warrior: Option<stats::DccWarrior<S>>,
    ///Wizard/Elf spellcasting (spellburn, corruption, mercurial magic)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub wizard: Option<stats::DccWizard<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Thief class features and skills

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccThief<S: BosStr = DefaultStr> {
    ///Alignment (affects some skill targets)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alignment: Option<S>,
    ///Backstab damage die level (+1, +2, etc.)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub backstab: Option<i64>,
    ///Weapon type that luck applies to (one type only)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lucky_weapon: Option<S>,
    ///Thief skill modifiers
    #[serde(skip_serializing_if = "Option::is_none")]
    pub skills: Option<stats::DccThiefSkills<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Thief skill bonuses (roll d20 + skill vs target)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccThiefSkills<S: BosStr = DefaultStr> {
    ///Backstab attack bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub backstab: Option<i64>,
    ///Cast spell from scroll bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cast_spell_from_scroll: Option<i64>,
    ///Climb sheer surfaces bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub climb_sheer_surfaces: Option<i64>,
    ///Disable trap bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disable_trap: Option<i64>,
    ///Disguise self bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disguise_self: Option<i64>,
    ///Find trap bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub find_trap: Option<i64>,
    ///Forge document bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub forge_document: Option<i64>,
    ///Handle poison bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub handle_poison: Option<i64>,
    ///Hide in shadows bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hide_in_shadows: Option<i64>,
    ///Pick lock bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pick_lock: Option<i64>,
    ///Pick pocket bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pick_pocket: Option<i64>,
    ///Read languages bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub read_languages: Option<i64>,
    ///Sneak silently bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sneak_silently: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Warrior and Dwarf class features

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccWarrior<S: BosStr = DefaultStr> {
    ///Current deed die (d3, d4, d5, d6, d7, d8, d10+d3, etc.)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deed_die: Option<S>,
    ///Infravision range in feet (Dwarves: 60)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub infravision: Option<i64>,
    ///Weapon type luck modifier applies to
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lucky_weapon: Option<S>,
    ///Signature mighty deeds of arms
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mighty_deeds: Option<Vec<S>>,
    ///Can use shield bash (Dwarves)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub shield_bash: Option<bool>,
    ///Can smell gold/gems (Dwarves)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub smell_gold: Option<bool>,
    ///Underground detection bonus (Dwarves: equal to level)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub underground_skills: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Wizard and Elf spellcasting features

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccWizard<S: BosStr = DefaultStr> {
    ///Corruption effects suffered (structured)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub corruption: Option<Vec<stats::DccCorruption<S>>>,
    ///Corruption effects as free-form text
    #[serde(skip_serializing_if = "Option::is_none")]
    pub corruption_text: Option<S>,
    ///Known spells with mercurial magic effects
    #[serde(skip_serializing_if = "Option::is_none")]
    pub known_spells: Option<Vec<stats::DccWizardSpell<S>>>,
    ///Highest spell level accessible
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_spell_level: Option<i64>,
    ///Supernatural patron (if any)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub patron: Option<S>,
    ///Patron bond description and effects
    #[serde(skip_serializing_if = "Option::is_none")]
    pub patron_bond: Option<S>,
    ///Spell check modifier (INT mod + level)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub spell_check_mod: Option<i64>,
    ///Current spellburn status
    #[serde(skip_serializing_if = "Option::is_none")]
    pub spellburn: Option<stats::DccSpellburn<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A wizard spell with mercurial magic effect

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DccWizardSpell<S: BosStr = DefaultStr> {
    ///Spell level
    pub level: i64,
    ///Spell is currently lost (must be re-learned)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lost: Option<bool>,
    ///Unique mercurial magic effect (d100 roll result)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mercurial_magic: Option<S>,
    ///The d100 roll for mercurial magic
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mercurial_roll: Option<i64>,
    ///Spell name
    pub name: S,
    ///Additional spell notes
    #[serde(skip_serializing_if = "Option::is_none")]
    pub notes: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Death saving throw successes and failures

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DeathSaves<S: BosStr = DefaultStr> {
    ///Failures (0-3)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub failures: Option<i64>,
    ///Successes (0-3)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub successes: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// D&D 5e character sheet. All sub-objects are optional.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DndStats<S: BosStr = DefaultStr> {
    ///The six ability scores (STR, DEX, CON, INT, WIS, CHA)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub abilities: Option<stats::Abilities<S>>,
    ///Attack actions
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attacks: Option<Vec<stats::Attack<S>>>,
    ///Currency (cp, sp, ep, gp, pp)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub coinage: Option<stats::Coinage<S>>,
    ///Combat stats (AC, speed, initiative, hit dice)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub combat: Option<stats::Combat<S>>,
    ///Status conditions (inspiration, exhaustion, death saves)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub conditions: Option<stats::Conditions<S>>,
    ///Gear and inventory
    #[serde(skip_serializing_if = "Option::is_none")]
    pub equipment: Option<stats::Equipment<S>>,
    ///Class features, racial traits, and feats
    #[serde(skip_serializing_if = "Option::is_none")]
    pub features: Option<S>,
    ///Hit points (current, max, temp)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hp: Option<stats::Hp<S>>,
    ///Character identity (race, class, level, background)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub identity: Option<stats::Identity<S>>,
    ///Languages known
    #[serde(skip_serializing_if = "Option::is_none")]
    pub languages: Option<S>,
    ///Passive scores (Perception, Investigation, Insight)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub passives: Option<stats::Passives<S>>,
    ///Traits, ideals, bonds, flaws, backstory
    #[serde(skip_serializing_if = "Option::is_none")]
    pub personality: Option<stats::Personality<S>>,
    ///Armor, weapon, and tool proficiencies
    #[serde(skip_serializing_if = "Option::is_none")]
    pub proficiencies: Option<S>,
    ///Saving throw modifiers
    #[serde(skip_serializing_if = "Option::is_none")]
    pub saves: Option<stats::Saves<S>>,
    ///Skill modifiers
    #[serde(skip_serializing_if = "Option::is_none")]
    pub skills: Option<stats::Skills<S>>,
    ///Spellcasting details (for casters)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub spellcasting: Option<stats::Spellcasting<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Gear and inventory

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Equipment<S: BosStr = DefaultStr> {
    ///Armor
    #[serde(skip_serializing_if = "Option::is_none")]
    pub armor: Option<S>,
    ///Other equipment
    #[serde(skip_serializing_if = "Option::is_none")]
    pub gear: Option<S>,
    ///Valuables and treasure
    #[serde(skip_serializing_if = "Option::is_none")]
    pub treasure: Option<S>,
    ///Weapons
    #[serde(skip_serializing_if = "Option::is_none")]
    pub weapons: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Hit point tracking

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Hp<S: BosStr = DefaultStr> {
    ///Current HP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub current: Option<i64>,
    ///Maximum HP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max: Option<i64>,
    ///Temporary HP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub temp: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Character identity and progression

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Identity<S: BosStr = DefaultStr> {
    ///Alignment (e.g., Lawful Good)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alignment: Option<S>,
    ///Background (e.g., Soldier, Sage)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub background: Option<S>,
    ///Class and subclass (e.g., Fighter (Champion))
    #[serde(skip_serializing_if = "Option::is_none")]
    pub class: Option<S>,
    ///Character level
    #[serde(skip_serializing_if = "Option::is_none")]
    pub level: Option<i64>,
    ///Proficiency bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub proficiency: Option<i64>,
    ///Race (e.g., Human, Elf, Dwarf)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub race: Option<S>,
    ///Experience points
    #[serde(skip_serializing_if = "Option::is_none")]
    pub xp: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A user's RPG character statistics. One record per user (rkey: self).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "actor.rpg.stats",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Stats<S: BosStr = DefaultStr> {
    ///Timestamp when this record was created
    pub created_at: Datetime,
    ///User-defined custom stat system
    #[serde(skip_serializing_if = "Option::is_none")]
    pub custom: Option<stats::CustomStats<S>>,
    ///Dungeon Crawl Classics RPG character sheet
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dcc: Option<stats::DccStats<S>>,
    ///Dungeons & Dragons 5th Edition character sheet
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dnd: Option<stats::DndStats<S>>,
    ///Reverie House philosophical alignment
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reverie: Option<stats::ReverieStats<S>>,
    ///RPG Maker MZ engine character parameters
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rmmz: Option<stats::RmmzStats<S>>,
    ///Timestamp when this record was last modified
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Typed wrapper for GetRecord response with this collection's record type.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct StatsGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Stats<S>,
}

/// Passive scores (10 + skill modifier)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Passives<S: BosStr = DefaultStr> {
    ///Passive Insight
    #[serde(skip_serializing_if = "Option::is_none")]
    pub insight: Option<i64>,
    ///Passive Investigation
    #[serde(skip_serializing_if = "Option::is_none")]
    pub investigation: Option<i64>,
    ///Passive Perception
    #[serde(skip_serializing_if = "Option::is_none")]
    pub perception: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Personality and backstory

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Personality<S: BosStr = DefaultStr> {
    ///Backstory
    #[serde(skip_serializing_if = "Option::is_none")]
    pub backstory: Option<S>,
    ///Bonds
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bonds: Option<S>,
    ///Flaws
    #[serde(skip_serializing_if = "Option::is_none")]
    pub flaws: Option<S>,
    ///Ideals
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ideals: Option<S>,
    ///Personality traits
    #[serde(skip_serializing_if = "Option::is_none")]
    pub traits: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Reverie House philosophical alignment

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ReverieStats<S: BosStr = DefaultStr> {
    ///Authority (0-100)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub authority: Option<i64>,
    ///Entropy (0-100)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub entropy: Option<i64>,
    ///Liberty (0-100)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub liberty: Option<i64>,
    ///Oblivion (0-100)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub oblivion: Option<i64>,
    ///Philosophical octant
    #[serde(skip_serializing_if = "Option::is_none")]
    pub octant: Option<ReverieStatsOctant<S>>,
    ///Receptive (0-100)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub receptive: Option<i64>,
    ///Skeptic (0-100)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub skeptic: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Philosophical octant

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ReverieStatsOctant<S: BosStr = DefaultStr> {
    Adaptive,
    Chaotic,
    Prepared,
    Intended,
    Contented,
    Assertive,
    Ordered,
    Guarded,
    Equilibrium,
    Singling,
    Confused,
    Other(S),
}

impl<S: BosStr> ReverieStatsOctant<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Adaptive => "adaptive",
            Self::Chaotic => "chaotic",
            Self::Prepared => "prepared",
            Self::Intended => "intended",
            Self::Contented => "contented",
            Self::Assertive => "assertive",
            Self::Ordered => "ordered",
            Self::Guarded => "guarded",
            Self::Equilibrium => "equilibrium",
            Self::Singling => "singling",
            Self::Confused => "confused",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "adaptive" => Self::Adaptive,
            "chaotic" => Self::Chaotic,
            "prepared" => Self::Prepared,
            "intended" => Self::Intended,
            "contented" => Self::Contented,
            "assertive" => Self::Assertive,
            "ordered" => Self::Ordered,
            "guarded" => Self::Guarded,
            "equilibrium" => Self::Equilibrium,
            "singling" => Self::Singling,
            "confused" => Self::Confused,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> core::fmt::Display for ReverieStatsOctant<S> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<S: BosStr> AsRef<str> for ReverieStatsOctant<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<S: BosStr> Serialize for ReverieStatsOctant<S> {
    fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
    where
        Ser: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ReverieStatsOctant<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr + Default> Default for ReverieStatsOctant<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for ReverieStatsOctant<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ReverieStatsOctant<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ReverieStatsOctant::Adaptive => ReverieStatsOctant::Adaptive,
            ReverieStatsOctant::Chaotic => ReverieStatsOctant::Chaotic,
            ReverieStatsOctant::Prepared => ReverieStatsOctant::Prepared,
            ReverieStatsOctant::Intended => ReverieStatsOctant::Intended,
            ReverieStatsOctant::Contented => ReverieStatsOctant::Contented,
            ReverieStatsOctant::Assertive => ReverieStatsOctant::Assertive,
            ReverieStatsOctant::Ordered => ReverieStatsOctant::Ordered,
            ReverieStatsOctant::Guarded => ReverieStatsOctant::Guarded,
            ReverieStatsOctant::Equilibrium => ReverieStatsOctant::Equilibrium,
            ReverieStatsOctant::Singling => ReverieStatsOctant::Singling,
            ReverieStatsOctant::Confused => ReverieStatsOctant::Confused,
            ReverieStatsOctant::Other(v) => ReverieStatsOctant::Other(v.into_static()),
        }
    }
}

/// RPG Maker MZ character parameters

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct RmmzStats<S: BosStr = DefaultStr> {
    ///Agility
    #[serde(skip_serializing_if = "Option::is_none")]
    pub agi: Option<i64>,
    ///Attack
    #[serde(skip_serializing_if = "Option::is_none")]
    pub atk: Option<i64>,
    ///Class
    #[serde(skip_serializing_if = "Option::is_none")]
    pub class: Option<S>,
    ///Critical %
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cri: Option<i64>,
    ///Defense
    #[serde(skip_serializing_if = "Option::is_none")]
    pub def: Option<i64>,
    ///Evasion %
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eva: Option<i64>,
    ///Hit Rate %
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hit: Option<i64>,
    ///Current HP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hp: Option<i64>,
    ///Level
    #[serde(skip_serializing_if = "Option::is_none")]
    pub level: Option<i64>,
    ///Luck
    #[serde(skip_serializing_if = "Option::is_none")]
    pub luk: Option<i64>,
    ///Magic Attack
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mat: Option<i64>,
    ///Max HP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_hp: Option<i64>,
    ///Max MP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_mp: Option<i64>,
    ///Max TP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_tp: Option<i64>,
    ///Magic Defense
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mdf: Option<i64>,
    ///Current MP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mp: Option<i64>,
    ///Current TP
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tp: Option<i64>,
    ///Experience
    #[serde(skip_serializing_if = "Option::is_none")]
    pub xp: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Saving throw modifiers (actual values, not proficiency flags)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Saves<S: BosStr = DefaultStr> {
    ///Charisma save modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cha: Option<i64>,
    ///Constitution save modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub con: Option<i64>,
    ///Dexterity save modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dex: Option<i64>,
    ///Intelligence save modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub int: Option<i64>,
    ///Strength save modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub str: Option<i64>,
    ///Wisdom save modifier
    #[serde(skip_serializing_if = "Option::is_none")]
    pub wis: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Skill modifiers (actual values, not proficiency flags)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Skills<S: BosStr = DefaultStr> {
    ///Acrobatics (DEX)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub acrobatics: Option<i64>,
    ///Animal Handling (WIS)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub animal_handling: Option<i64>,
    ///Arcana (INT)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub arcana: Option<i64>,
    ///Athletics (STR)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub athletics: Option<i64>,
    ///Deception (CHA)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deception: Option<i64>,
    ///History (INT)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub history: Option<i64>,
    ///Insight (WIS)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub insight: Option<i64>,
    ///Intimidation (CHA)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub intimidation: Option<i64>,
    ///Investigation (INT)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub investigation: Option<i64>,
    ///Medicine (WIS)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub medicine: Option<i64>,
    ///Nature (INT)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub nature: Option<i64>,
    ///Perception (WIS)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub perception: Option<i64>,
    ///Performance (CHA)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub performance: Option<i64>,
    ///Persuasion (CHA)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub persuasion: Option<i64>,
    ///Religion (INT)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub religion: Option<i64>,
    ///Sleight of Hand (DEX)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sleight_of_hand: Option<i64>,
    ///Stealth (DEX)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub stealth: Option<i64>,
    ///Survival (WIS)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub survival: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Spells organized by level

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SpellList<S: BosStr = DefaultStr> {
    ///Cantrips (at-will)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cantrips: Option<Vec<S>>,
    ///1st-level spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub l1: Option<Vec<S>>,
    ///2nd-level spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub l2: Option<Vec<S>>,
    ///3rd-level spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub l3: Option<Vec<S>>,
    ///4th-level spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub l4: Option<Vec<S>>,
    ///5th-level spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub l5: Option<Vec<S>>,
    ///6th-level spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub l6: Option<Vec<S>>,
    ///7th-level spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub l7: Option<Vec<S>>,
    ///8th-level spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub l8: Option<Vec<S>>,
    ///9th-level spells
    #[serde(skip_serializing_if = "Option::is_none")]
    pub l9: Option<Vec<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Spellcasting details

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Spellcasting<S: BosStr = DefaultStr> {
    ///Spellcasting ability (INT, WIS, CHA)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ability: Option<S>,
    ///Spell attack bonus
    #[serde(skip_serializing_if = "Option::is_none")]
    pub attack: Option<i64>,
    ///Spell save DC
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dc: Option<i64>,
    ///Spell slots by level
    #[serde(skip_serializing_if = "Option::is_none")]
    pub slots: Option<Vec<stats::Spellslot<S>>>,
    ///Known/prepared spells by level
    #[serde(skip_serializing_if = "Option::is_none")]
    pub spells: Option<stats::SpellList<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Spell slot entry

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Spellslot<S: BosStr = DefaultStr> {
    ///Spell level
    pub level: i64,
    ///Total slots
    pub total: i64,
    ///Slots used
    #[serde(skip_serializing_if = "Option::is_none")]
    pub used: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

impl<S: BosStr> Stats<S> {
    pub fn uri(uri: S) -> Result<RecordUri<S, StatsRecord>, UriError> {
        RecordUri::try_from_uri(AtUri::new(uri)?)
    }
}

impl<S: BosStr> LexiconSchema for Abilities<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "abilities"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.cha {
            if *value > 30i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("cha"),
                    max: 30i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.cha {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("cha"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.con {
            if *value > 30i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("con"),
                    max: 30i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.con {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("con"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.dex {
            if *value > 30i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("dex"),
                    max: 30i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.dex {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("dex"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.int {
            if *value > 30i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("int"),
                    max: 30i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.int {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("int"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.str {
            if *value > 30i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("str"),
                    max: 30i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.str {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("str"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.wis {
            if *value > 30i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("wis"),
                    max: 30i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.wis {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("wis"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Attack<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "attack"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.bonus {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("bonus"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.damage {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("damage"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.damage_type {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("damage_type"),
                    max: 30usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.name;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Coinage<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "coinage"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.cp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("cp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.ep {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("ep"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.gp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("gp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.pp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("pp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.sp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("sp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Combat<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "combat"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.ac {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("ac"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.hit_dice {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("hit_dice"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.hit_dice_used {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("hit_dice_used"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.speed {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("speed"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Conditions<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "conditions"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.exhaustion {
            if *value > 6i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("exhaustion"),
                    max: 6i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.exhaustion {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("exhaustion"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for CustomStat<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "customStat"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.category {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("category"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.name;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for CustomStats<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "customStats"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.system_name {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("system_name"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.system_version {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("system_version"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccAbilities<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccAbilities"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.agi {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("agi"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.agi {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("agi"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.agi_base {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("agi_base"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.agi_base {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("agi_base"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.int {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("int"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.int {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("int"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.luk {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("luk"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.luk {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("luk"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.per {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("per"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.per {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("per"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.sta {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("sta"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.sta {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("sta"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.sta_base {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("sta_base"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.sta_base {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("sta_base"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.str {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("str"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.str {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("str"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.str_base {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("str_base"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.str_base {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("str_base"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccAttack<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccAttack"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.attack_mod {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("attack_mod"),
                    max: 30usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.damage {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("damage"),
                    max: 30usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.damage_bonus {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("damage_bonus"),
                    max: 30usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.name;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.notes {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("notes"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.range {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("range"),
                    max: 30usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.r#type {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("type"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccCleric<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccCleric"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.deity {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("deity"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.disapproval_range {
            if *value > 20i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("disapproval_range"),
                    max: 20i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.disapproval_range {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("disapproval_range"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.disapproval_table {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("disapproval_table"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.holy_symbol {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("holy_symbol"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.known_spells {
            #[allow(unused_comparisons)]
            if value.len() > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("known_spells"),
                    max: 50usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.lay_on_hands_die {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("lay_on_hands_die"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.max_spell_level {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("max_spell_level"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.max_spell_level {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("max_spell_level"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.turn_unholy_die {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("turn_unholy_die"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccClericSpell<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccClericSpell"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.level;
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("level"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.level;
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("level"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.name;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.notes {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("notes"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccCoinage<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccCoinage"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.cp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("cp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.gp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("gp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.sp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("sp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccCombat<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccCombat"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.ac {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("ac"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.action_die {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("action_die"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.crit_die {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("crit_die"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.crit_table {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("crit_table"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.fumble_die {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("fumble_die"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.speed {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("speed"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccCorruption<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccCorruption"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.effect {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("effect"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.source {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("source"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.r#type {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("type"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccEquipment<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccEquipment"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.armor {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("armor"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.armor_check_penalty {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("armor_check_penalty"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.gear {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("gear"),
                    max: 2000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.shield {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("shield"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.trade_goods {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("trade_goods"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.treasure {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("treasure"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.weapons {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("weapons"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccHalfling<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccHalfling"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.infravision {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("infravision"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.luck_spent_on_allies {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("luck_spent_on_allies"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.lucky_weapon {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("lucky_weapon"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccHp<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccHp"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.current {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("current"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.max {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("max"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccIdentity<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccIdentity"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.alignment {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("alignment"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.class {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("class"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.level {
            if *value > 10i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("level"),
                    max: 10i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.level {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("level"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.occupation {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("occupation"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.title {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("title"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.xp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("xp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccLuck<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccLuck"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.birth_augur {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("birth_augur"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.birth_augur_effect {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("birth_augur_effect"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.lucky_weapon {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("lucky_weapon"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.starting_luck {
            if *value > 24i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("starting_luck"),
                    max: 24i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.starting_luck {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("starting_luck"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccSaves<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccSaves"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccSpellburn<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccSpellburn"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.agi_burned {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("agi_burned"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.recovery_rate {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("recovery_rate"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.sta_burned {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("sta_burned"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.str_burned {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("str_burned"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccStats<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccStats"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.abilities_notes {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("abilities_notes"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.attacks {
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("attacks"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.languages {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("languages"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.notes {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 5000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("notes"),
                    max: 5000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccThief<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccThief"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.alignment {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("alignment"),
                    max: 20usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.backstab {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("backstab"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.lucky_weapon {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("lucky_weapon"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccThiefSkills<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccThiefSkills"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccWarrior<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccWarrior"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.deed_die {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("deed_die"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.infravision {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("infravision"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.lucky_weapon {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("lucky_weapon"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.mighty_deeds {
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("mighty_deeds"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.underground_skills {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("underground_skills"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccWizard<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccWizard"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.corruption {
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("corruption"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.corruption_text {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("corruption_text"),
                    max: 2000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.known_spells {
            #[allow(unused_comparisons)]
            if value.len() > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("known_spells"),
                    max: 50usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.max_spell_level {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("max_spell_level"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.max_spell_level {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("max_spell_level"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.patron {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("patron"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.patron_bond {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("patron_bond"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DccWizardSpell<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dccWizardSpell"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.level;
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("level"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.level;
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("level"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.mercurial_magic {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("mercurial_magic"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.mercurial_roll {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("mercurial_roll"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.mercurial_roll {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("mercurial_roll"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.name;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.notes {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("notes"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DeathSaves<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "deathSaves"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.failures {
            if *value > 3i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("failures"),
                    max: 3i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.failures {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("failures"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.successes {
            if *value > 3i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("successes"),
                    max: 3i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.successes {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("successes"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for DndStats<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "dndStats"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.attacks {
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("attacks"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.features {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 5000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("features"),
                    max: 5000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.languages {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("languages"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.proficiencies {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("proficiencies"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Equipment<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "equipment"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.armor {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("armor"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.gear {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("gear"),
                    max: 2000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.treasure {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("treasure"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.weapons {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("weapons"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Hp<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "hp"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.current {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("current"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.max {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("max"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.temp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("temp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Identity<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "identity"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.alignment {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("alignment"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.background {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("background"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.class {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("class"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.level {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("level"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.proficiency {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("proficiency"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.race {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("race"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.xp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("xp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

/// Marker type for deserializing records from this collection.

#[derive(Debug, Serialize, Deserialize)]
pub struct StatsRecord;
impl XrpcResp for StatsRecord {
    const NSID: &'static str = "actor.rpg.stats";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = StatsGetRecordOutput<S>;
    type Err = RecordError;
}

impl<S: BosStr> From<StatsGetRecordOutput<S>> for Stats<S> {
    fn from(output: StatsGetRecordOutput<S>) -> Self {
        output.value
    }
}

impl<S: BosStr> Collection for Stats<S> {
    const NSID: &'static str = "actor.rpg.stats";
    type Record = StatsRecord;
}

impl Collection for StatsRecord {
    const NSID: &'static str = "actor.rpg.stats";
    type Record = StatsRecord;
}

impl<S: BosStr> LexiconSchema for Stats<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Passives<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "passives"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Personality<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "personality"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.backstory {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 5000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("backstory"),
                    max: 5000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.bonds {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("bonds"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.flaws {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("flaws"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.ideals {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("ideals"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.traits {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("traits"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ReverieStats<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "reverieStats"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.authority {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("authority"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.authority {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("authority"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.entropy {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("entropy"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.entropy {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("entropy"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.liberty {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("liberty"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.liberty {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("liberty"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.oblivion {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("oblivion"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.oblivion {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("oblivion"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.receptive {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("receptive"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.receptive {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("receptive"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.skeptic {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("skeptic"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.skeptic {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("skeptic"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RmmzStats<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "rmmzStats"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.agi {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("agi"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.atk {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("atk"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.class {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("class"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.cri {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("cri"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.cri {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("cri"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.def {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("def"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.eva {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("eva"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.eva {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("eva"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.hit {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("hit"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.hit {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("hit"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.hp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("hp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.level {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("level"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.luk {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("luk"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.mat {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("mat"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.max_hp {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("max_hp"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.max_mp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("max_mp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.max_tp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("max_tp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.mdf {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("mdf"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.mp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("mp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.tp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("tp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.xp {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("xp"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Saves<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "saves"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Skills<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "skills"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for SpellList<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "spellList"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.cantrips {
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("cantrips"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.l1 {
            #[allow(unused_comparisons)]
            if value.len() > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("l1"),
                    max: 30usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.l2 {
            #[allow(unused_comparisons)]
            if value.len() > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("l2"),
                    max: 30usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.l3 {
            #[allow(unused_comparisons)]
            if value.len() > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("l3"),
                    max: 30usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.l4 {
            #[allow(unused_comparisons)]
            if value.len() > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("l4"),
                    max: 30usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.l5 {
            #[allow(unused_comparisons)]
            if value.len() > 30usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("l5"),
                    max: 30usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.l6 {
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("l6"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.l7 {
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("l7"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.l8 {
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("l8"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.l9 {
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("l9"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Spellcasting<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "spellcasting"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.ability {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 3usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("ability"),
                    max: 3usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.dc {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("dc"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.slots {
            #[allow(unused_comparisons)]
            if value.len() > 9usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("slots"),
                    max: 9usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Spellslot<S> {
    fn nsid() -> &'static str {
        "actor.rpg.stats"
    }
    fn def_name() -> &'static str {
        "spellslot"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_actor_rpg_stats()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.level;
            if *value > 9i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("level"),
                    max: 9i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.level;
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("level"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.total;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("total"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.used {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("used"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

fn lexicon_doc_actor_rpg_stats() -> 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("actor.rpg.stats"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("abilities"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("The six ability scores (1-30 per SRD)"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cha"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(30i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("con"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(30i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("dex"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(30i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("int"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(30i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("str"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(30i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("wis"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(30i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("attack"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("An attack action")),
                    required: Some(vec![SmolStr::new_static("name")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("bonus"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Attack bonus (e.g., +5)"),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("damage"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Damage dice (e.g., 1d8)"),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("damageBonus"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("damageType"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Damage type")),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Attack name")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("coinage"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Currency")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("ep"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("gp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("combat"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Combat and defensive stats")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("ac"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("hitDice"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Hit dice (e.g., 5d10)"),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("hitDiceUsed"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("initiative"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("speed"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("conditions"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Status conditions and effects"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("deathSaves"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#deathSaves"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("exhaustion"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(6i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("inspiration"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("customStat"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("A custom stat")),
                    required: Some(
                        vec![SmolStr::new_static("name"), SmolStr::new_static("value")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("category"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Category (optional)"),
                                ),
                                max_length: Some(50usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("max"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("min"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Stat name")),
                                max_length: Some(50usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("value"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("customStats"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("User-defined custom stat system"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("stats"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Custom stat entries"),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#customStat"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("systemName"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("System name")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("systemVersion"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Version")),
                                max_length: Some(50usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccAbilities"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "DCC ability scores (3-18 standard, can be modified by corruption/spellburn)",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("agi"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("agiBase"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("int"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("luk"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("per"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sta"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("staBase"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("str"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("strBase"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccAttack"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A weapon attack (includes deed die for warriors)",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("name")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("attackMod"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Attack modifier (e.g., +2, d16+2 for deed die)",
                                    ),
                                ),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("damage"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Damage dice (e.g., 1d8+2, 1d6+d3)"),
                                ),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("damageBonus"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Damage bonus (e.g., +2, +d3 for deed die)",
                                    ),
                                ),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Weapon name")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("notes"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Special properties (backstab, trained weapon, etc.)",
                                    ),
                                ),
                                max_length: Some(200usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("range"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Range (melee or distance)"),
                                ),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Attack type (melee, ranged, etc.)"),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccCleric"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Cleric spellcasting features"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("deity"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Deity or supernatural patron"),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("disapprovalRange"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(20i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("disapprovalTable"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Deity-specific disapproval table if any",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("holySymbol"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Holy symbol description"),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("knownSpells"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Known cleric spells"),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#dccClericSpell"),
                                    ..Default::default()
                                }),
                                max_length: Some(50usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("layOnHandsDie"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Lay on hands die (e.g., d14, d16)"),
                                ),
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxSpellLevel"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(5i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("spellCheckMod"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("turnUnholyDie"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Turn unholy die (e.g., d14, d16)"),
                                ),
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("unholy"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccClericSpell"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("A cleric spell")),
                    required: Some(
                        vec![SmolStr::new_static("name"), SmolStr::new_static("level")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("level"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(5i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Spell name")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("notes"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Additional spell notes"),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sinful"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccCoinage"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "DCC uses cp, sp, gp (10cp = 1sp, 10sp = 1gp)",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("gp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccCombat"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Combat statistics")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("ac"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("actionDie"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Primary action die (e.g., d20, d20+d14)",
                                    ),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("attackMod"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("critDie"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Critical hit die (e.g., d8, d12, d14)"),
                                ),
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("critTable"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Critical hit table (I, II, III, IV, V)"),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("fumbleDie"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Fumble die (typically d4 for 0-level, varies by armor)",
                                    ),
                                ),
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("initiative"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("speed"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccCorruption"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A corruption effect from failed spell checks",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("effect"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Description of the corruption"),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("permanent"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("source"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("What spell caused this corruption"),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Corruption severity (minor, major, greater)",
                                    ),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccEquipment"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Equipment and inventory")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("armor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Armor worn (affects fumble die)"),
                                ),
                                max_length: Some(200usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("armorCheckPenalty"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("gear"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Other equipment")),
                                max_length: Some(2000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("shield"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Shield (if any)")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tradeGoods"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Trade goods from occupation"),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("treasure"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Valuables and treasure"),
                                ),
                                max_length: Some(1000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("weapons"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Weapons carried")),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccHalfling"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Halfling class features")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("goodLuckCharm"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("infravision"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("luckSpentOnAllies"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("luckyWeapon"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Weapon type luck modifier applies to"),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sneakAndHide"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("twoWeaponFighting"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccHp"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Hit points (0-level characters use 1d4 + STA mod)",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("current"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("max"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccIdentity"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("DCC character identity and progression"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("alignment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Alignment (Lawful, Neutral, Chaotic)"),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("class"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Class (Warrior, Wizard, Cleric, Thief, Elf, Dwarf, Halfling)",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("level"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(10i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("occupation"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "0-level occupation (e.g., Blacksmith, Farmer)",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Level title (e.g., Squire, Cutpurse, Acolyte)",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("xp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccLuck"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Birth augur and luck mechanics"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("birthAugur"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Birth augur name (e.g., Harsh Winter, The Bull, Fortunate Date)",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("birthAugurEffect"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("What the luck modifier applies to"),
                                ),
                                max_length: Some(200usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("luckyWeapon"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Weapon type that luck applies to (Dwarves/Halflings)",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("startingLuck"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(24i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccSaves"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("DCC saving throws (3 saves, not 6)"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("fort"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("ref"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("will"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccSpellburn"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Current spellburn (temporary ability score sacrifice)",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("agiBurned"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("recoveryRate"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("staBurned"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("strBurned"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccStats"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Dungeon Crawl Classics RPG character sheet. Supports 0-level funnel characters through 10th level.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("abilities"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccAbilities"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("abilitiesNotes"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Notes about special abilities, class features, and racial traits",
                                    ),
                                ),
                                max_length: Some(1000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("attacks"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("Weapon attacks")),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#dccAttack"),
                                    ..Default::default()
                                }),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cleric"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccCleric"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("coinage"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccCoinage"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("combat"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccCombat"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("equipment"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccEquipment"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("halfling"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccHalfling"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("hp"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccHp"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("identity"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccIdentity"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("languages"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Languages known")),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("luck"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccLuck"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("notes"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Character notes, backstory, and special abilities",
                                    ),
                                ),
                                max_length: Some(5000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("saves"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccSaves"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("thief"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccThief"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("warrior"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccWarrior"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("wizard"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccWizard"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccThief"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Thief class features and skills"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("alignment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Alignment (affects some skill targets)"),
                                ),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("backstab"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("luckyWeapon"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Weapon type that luck applies to (one type only)",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("skills"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccThiefSkills"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccThiefSkills"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Thief skill bonuses (roll d20 + skill vs target)",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("backstab"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("castSpellFromScroll"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("climbSheerSurfaces"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("disableTrap"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("disguiseSelf"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("findTrap"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("forgeDocument"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("handlePoison"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("hideInShadows"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pickLock"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pickPocket"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("readLanguages"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sneakSilently"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccWarrior"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Warrior and Dwarf class features"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("deedDie"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Current deed die (d3, d4, d5, d6, d7, d8, d10+d3, etc.)",
                                    ),
                                ),
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("infravision"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("luckyWeapon"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Weapon type luck modifier applies to"),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("mightyDeeds"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Signature mighty deeds of arms"),
                                ),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(200usize),
                                    ..Default::default()
                                }),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("shieldBash"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("smellGold"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("undergroundSkills"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccWizard"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Wizard and Elf spellcasting features"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("corruption"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Corruption effects suffered (structured)",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#dccCorruption"),
                                    ..Default::default()
                                }),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("corruptionText"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Corruption effects as free-form text"),
                                ),
                                max_length: Some(2000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("knownSpells"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Known spells with mercurial magic effects",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#dccWizardSpell"),
                                    ..Default::default()
                                }),
                                max_length: Some(50usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxSpellLevel"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(5i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("patron"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Supernatural patron (if any)"),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("patronBond"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Patron bond description and effects"),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("spellCheckMod"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("spellburn"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#dccSpellburn"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dccWizardSpell"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A wizard spell with mercurial magic effect"),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("name"), SmolStr::new_static("level")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("level"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(5i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lost"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("mercurialMagic"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Unique mercurial magic effect (d100 roll result)",
                                    ),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("mercurialRoll"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Spell name")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("notes"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Additional spell notes"),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("deathSaves"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Death saving throw successes and failures"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("failures"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(3i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("successes"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(3i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("dndStats"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "D&D 5e character sheet. All sub-objects are optional.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("abilities"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#abilities"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("attacks"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("Attack actions")),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#attack"),
                                    ..Default::default()
                                }),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("coinage"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#coinage"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("combat"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#combat"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("conditions"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#conditions"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("equipment"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#equipment"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("features"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Class features, racial traits, and feats",
                                    ),
                                ),
                                max_length: Some(5000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("hp"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#hp"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("identity"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#identity"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("languages"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Languages known")),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("passives"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#passives"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("personality"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#personality"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("proficiencies"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Armor, weapon, and tool proficiencies"),
                                ),
                                max_length: Some(1000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("saves"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#saves"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("skills"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#skills"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("spellcasting"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#spellcasting"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("equipment"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Gear and inventory")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("armor"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Armor")),
                                max_length: Some(200usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("gear"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Other equipment")),
                                max_length: Some(2000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("treasure"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Valuables and treasure"),
                                ),
                                max_length: Some(1000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("weapons"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Weapons")),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("hp"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Hit point tracking")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("current"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("max"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("temp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("identity"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Character identity and progression"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("alignment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Alignment (e.g., Lawful Good)"),
                                ),
                                max_length: Some(50usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("background"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Background (e.g., Soldier, Sage)"),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("class"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Class and subclass (e.g., Fighter (Champion))",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("level"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("proficiency"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("race"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Race (e.g., Human, Elf, Dwarf)"),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("xp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(
                        CowStr::new_static(
                            "A user's RPG character statistics. One record per user (rkey: self).",
                        ),
                    ),
                    key: Some(CowStr::new_static("literal:self")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(vec![SmolStr::new_static("createdAt")]),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Timestamp when this record was created"),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("custom"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#customStats"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("dcc"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#dccStats"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("dnd"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#dndStats"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("reverie"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#reverieStats"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("rmmz"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#rmmzStats"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("updatedAt"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Timestamp when this record was last modified",
                                        ),
                                    ),
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("passives"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Passive scores (10 + skill modifier)"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("insight"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("investigation"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("perception"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("personality"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Personality and backstory")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("backstory"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Backstory")),
                                max_length: Some(5000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("bonds"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Bonds")),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("flaws"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Flaws")),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("ideals"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Ideals")),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("traits"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Personality traits")),
                                max_length: Some(1000usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reverieStats"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Reverie House philosophical alignment"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("authority"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("entropy"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("liberty"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("oblivion"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("octant"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Philosophical octant"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("receptive"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("skeptic"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("rmmzStats"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("RPG Maker MZ character parameters"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("agi"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("atk"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("class"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Class")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cri"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("def"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("eva"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("hit"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("hp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("level"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("luk"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("mat"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxHp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxMp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("maxTp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("mdf"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("mp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("xp"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("saves"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Saving throw modifiers (actual values, not proficiency flags)",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cha"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("con"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("dex"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("int"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("str"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("wis"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("skills"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Skill modifiers (actual values, not proficiency flags)",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("acrobatics"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("animalHandling"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("arcana"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("athletics"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("deception"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("history"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("insight"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("intimidation"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("investigation"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("medicine"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("nature"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("perception"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("performance"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("persuasion"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("religion"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sleightOfHand"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("stealth"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("survival"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("spellList"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Spells organized by level")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cantrips"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("Cantrips (at-will)")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("l1"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("1st-level spells")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("l2"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("2nd-level spells")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("l3"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("3rd-level spells")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("l4"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("4th-level spells")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("l5"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("5th-level spells")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(30usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("l6"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("6th-level spells")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("l7"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("7th-level spells")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("l8"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("8th-level spells")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("l9"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(CowStr::new_static("9th-level spells")),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("spellcasting"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Spellcasting details")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("ability"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Spellcasting ability (INT, WIS, CHA)"),
                                ),
                                max_length: Some(3usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("attack"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("dc"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("slots"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Spell slots by level"),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#spellslot"),
                                    ..Default::default()
                                }),
                                max_length: Some(9usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("spells"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#spellList"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("spellslot"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Spell slot entry")),
                    required: Some(
                        vec![SmolStr::new_static("level"), SmolStr::new_static("total")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("level"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                maximum: Some(9i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("total"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("used"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod custom_stat_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 Name;
        type Value;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Name = Unset;
        type Value = Unset;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Name = Set<members::name>;
        type Value = St::Value;
    }
    ///State transition - sets the `value` field to Set
    pub struct SetValue<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetValue<St> {}
    impl<St: State> State for SetValue<St> {
        type Name = St::Name;
        type Value = Set<members::value>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `value` field
        pub struct value(());
    }
}

/// Builder for constructing an instance of this type.
pub struct CustomStatBuilder<St: custom_stat_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<i64>, Option<i64>, Option<S>, Option<i64>),
    _type: PhantomData<fn() -> S>,
}

impl CustomStat<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> CustomStatBuilder<custom_stat_state::Empty, DefaultStr> {
        CustomStatBuilder::new()
    }
}

impl<S: BosStr> CustomStat<S> {
    /// Create a new builder for this type
    pub fn builder() -> CustomStatBuilder<custom_stat_state::Empty, S> {
        CustomStatBuilder::builder()
    }
}

impl CustomStatBuilder<custom_stat_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        CustomStatBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> CustomStatBuilder<custom_stat_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        CustomStatBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St: custom_stat_state::State, S: BosStr> CustomStatBuilder<St, S> {
    /// Set the `category` field (optional)
    pub fn category(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `category` field to an Option value (optional)
    pub fn maybe_category(mut self, value: Option<S>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St: custom_stat_state::State, S: BosStr> CustomStatBuilder<St, S> {
    /// Set the `max` field (optional)
    pub fn max(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `max` field to an Option value (optional)
    pub fn maybe_max(mut self, value: Option<i64>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: custom_stat_state::State, S: BosStr> CustomStatBuilder<St, S> {
    /// Set the `min` field (optional)
    pub fn min(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `min` field to an Option value (optional)
    pub fn maybe_min(mut self, value: Option<i64>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> CustomStatBuilder<St, S>
where
    St: custom_stat_state::State,
    St::Name: custom_stat_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> CustomStatBuilder<custom_stat_state::SetName<St>, S> {
        self._fields.3 = Option::Some(value.into());
        CustomStatBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CustomStatBuilder<St, S>
where
    St: custom_stat_state::State,
    St::Value: custom_stat_state::IsUnset,
{
    /// Set the `value` field (required)
    pub fn value(
        mut self,
        value: impl Into<i64>,
    ) -> CustomStatBuilder<custom_stat_state::SetValue<St>, S> {
        self._fields.4 = Option::Some(value.into());
        CustomStatBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CustomStatBuilder<St, S>
where
    St: custom_stat_state::State,
    St::Name: custom_stat_state::IsSet,
    St::Value: custom_stat_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> CustomStat<S> {
        CustomStat {
            category: self._fields.0,
            max: self._fields.1,
            min: self._fields.2,
            name: self._fields.3.unwrap(),
            value: self._fields.4.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> CustomStat<S> {
        CustomStat {
            category: self._fields.0,
            max: self._fields.1,
            min: self._fields.2,
            name: self._fields.3.unwrap(),
            value: self._fields.4.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod dcc_cleric_spell_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 Level;
        type Name;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Level = Unset;
        type Name = Unset;
    }
    ///State transition - sets the `level` field to Set
    pub struct SetLevel<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLevel<St> {}
    impl<St: State> State for SetLevel<St> {
        type Level = Set<members::level>;
        type Name = St::Name;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Level = St::Level;
        type Name = Set<members::name>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `level` field
        pub struct level(());
        ///Marker type for the `name` field
        pub struct name(());
    }
}

/// Builder for constructing an instance of this type.
pub struct DccClericSpellBuilder<
    St: dcc_cleric_spell_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<i64>, Option<S>, Option<S>, Option<bool>),
    _type: PhantomData<fn() -> S>,
}

impl DccClericSpell<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> DccClericSpellBuilder<dcc_cleric_spell_state::Empty, DefaultStr> {
        DccClericSpellBuilder::new()
    }
}

impl<S: BosStr> DccClericSpell<S> {
    /// Create a new builder for this type
    pub fn builder() -> DccClericSpellBuilder<dcc_cleric_spell_state::Empty, S> {
        DccClericSpellBuilder::builder()
    }
}

impl DccClericSpellBuilder<dcc_cleric_spell_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        DccClericSpellBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> DccClericSpellBuilder<dcc_cleric_spell_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        DccClericSpellBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> DccClericSpellBuilder<St, S>
where
    St: dcc_cleric_spell_state::State,
    St::Level: dcc_cleric_spell_state::IsUnset,
{
    /// Set the `level` field (required)
    pub fn level(
        mut self,
        value: impl Into<i64>,
    ) -> DccClericSpellBuilder<dcc_cleric_spell_state::SetLevel<St>, S> {
        self._fields.0 = Option::Some(value.into());
        DccClericSpellBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> DccClericSpellBuilder<St, S>
where
    St: dcc_cleric_spell_state::State,
    St::Name: dcc_cleric_spell_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> DccClericSpellBuilder<dcc_cleric_spell_state::SetName<St>, S> {
        self._fields.1 = Option::Some(value.into());
        DccClericSpellBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: dcc_cleric_spell_state::State, S: BosStr> DccClericSpellBuilder<St, S> {
    /// Set the `notes` field (optional)
    pub fn notes(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `notes` field to an Option value (optional)
    pub fn maybe_notes(mut self, value: Option<S>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: dcc_cleric_spell_state::State, S: BosStr> DccClericSpellBuilder<St, S> {
    /// Set the `sinful` field (optional)
    pub fn sinful(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `sinful` field to an Option value (optional)
    pub fn maybe_sinful(mut self, value: Option<bool>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> DccClericSpellBuilder<St, S>
where
    St: dcc_cleric_spell_state::State,
    St::Level: dcc_cleric_spell_state::IsSet,
    St::Name: dcc_cleric_spell_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> DccClericSpell<S> {
        DccClericSpell {
            level: self._fields.0.unwrap(),
            name: self._fields.1.unwrap(),
            notes: self._fields.2,
            sinful: self._fields.3,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> DccClericSpell<S> {
        DccClericSpell {
            level: self._fields.0.unwrap(),
            name: self._fields.1.unwrap(),
            notes: self._fields.2,
            sinful: self._fields.3,
            extra_data: Some(extra_data),
        }
    }
}

pub mod dcc_wizard_spell_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 Level;
        type Name;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Level = Unset;
        type Name = Unset;
    }
    ///State transition - sets the `level` field to Set
    pub struct SetLevel<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLevel<St> {}
    impl<St: State> State for SetLevel<St> {
        type Level = Set<members::level>;
        type Name = St::Name;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Level = St::Level;
        type Name = Set<members::name>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `level` field
        pub struct level(());
        ///Marker type for the `name` field
        pub struct name(());
    }
}

/// Builder for constructing an instance of this type.
pub struct DccWizardSpellBuilder<
    St: dcc_wizard_spell_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<i64>, Option<bool>, Option<S>, Option<i64>, Option<S>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

impl DccWizardSpell<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> DccWizardSpellBuilder<dcc_wizard_spell_state::Empty, DefaultStr> {
        DccWizardSpellBuilder::new()
    }
}

impl<S: BosStr> DccWizardSpell<S> {
    /// Create a new builder for this type
    pub fn builder() -> DccWizardSpellBuilder<dcc_wizard_spell_state::Empty, S> {
        DccWizardSpellBuilder::builder()
    }
}

impl DccWizardSpellBuilder<dcc_wizard_spell_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        DccWizardSpellBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> DccWizardSpellBuilder<dcc_wizard_spell_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        DccWizardSpellBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> DccWizardSpellBuilder<St, S>
where
    St: dcc_wizard_spell_state::State,
    St::Level: dcc_wizard_spell_state::IsUnset,
{
    /// Set the `level` field (required)
    pub fn level(
        mut self,
        value: impl Into<i64>,
    ) -> DccWizardSpellBuilder<dcc_wizard_spell_state::SetLevel<St>, S> {
        self._fields.0 = Option::Some(value.into());
        DccWizardSpellBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: dcc_wizard_spell_state::State, S: BosStr> DccWizardSpellBuilder<St, S> {
    /// Set the `lost` field (optional)
    pub fn lost(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `lost` field to an Option value (optional)
    pub fn maybe_lost(mut self, value: Option<bool>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: dcc_wizard_spell_state::State, S: BosStr> DccWizardSpellBuilder<St, S> {
    /// Set the `mercurialMagic` field (optional)
    pub fn mercurial_magic(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `mercurialMagic` field to an Option value (optional)
    pub fn maybe_mercurial_magic(mut self, value: Option<S>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: dcc_wizard_spell_state::State, S: BosStr> DccWizardSpellBuilder<St, S> {
    /// Set the `mercurialRoll` field (optional)
    pub fn mercurial_roll(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `mercurialRoll` field to an Option value (optional)
    pub fn maybe_mercurial_roll(mut self, value: Option<i64>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> DccWizardSpellBuilder<St, S>
where
    St: dcc_wizard_spell_state::State,
    St::Name: dcc_wizard_spell_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> DccWizardSpellBuilder<dcc_wizard_spell_state::SetName<St>, S> {
        self._fields.4 = Option::Some(value.into());
        DccWizardSpellBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: dcc_wizard_spell_state::State, S: BosStr> DccWizardSpellBuilder<St, S> {
    /// Set the `notes` field (optional)
    pub fn notes(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `notes` field to an Option value (optional)
    pub fn maybe_notes(mut self, value: Option<S>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St, S: BosStr> DccWizardSpellBuilder<St, S>
where
    St: dcc_wizard_spell_state::State,
    St::Level: dcc_wizard_spell_state::IsSet,
    St::Name: dcc_wizard_spell_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> DccWizardSpell<S> {
        DccWizardSpell {
            level: self._fields.0.unwrap(),
            lost: self._fields.1,
            mercurial_magic: self._fields.2,
            mercurial_roll: self._fields.3,
            name: self._fields.4.unwrap(),
            notes: self._fields.5,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> DccWizardSpell<S> {
        DccWizardSpell {
            level: self._fields.0.unwrap(),
            lost: self._fields.1,
            mercurial_magic: self._fields.2,
            mercurial_roll: self._fields.3,
            name: self._fields.4.unwrap(),
            notes: self._fields.5,
            extra_data: Some(extra_data),
        }
    }
}

pub mod stats_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;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
    impl<St: State> State for SetCreatedAt<St> {
        type CreatedAt = Set<members::created_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `created_at` field
        pub struct created_at(());
    }
}

/// Builder for constructing an instance of this type.
pub struct StatsBuilder<St: stats_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Datetime>,
        Option<stats::CustomStats<S>>,
        Option<stats::DccStats<S>>,
        Option<stats::DndStats<S>>,
        Option<stats::ReverieStats<S>>,
        Option<stats::RmmzStats<S>>,
        Option<Datetime>,
    ),
    _type: PhantomData<fn() -> S>,
}

impl Stats<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> StatsBuilder<stats_state::Empty, DefaultStr> {
        StatsBuilder::new()
    }
}

impl<S: BosStr> Stats<S> {
    /// Create a new builder for this type
    pub fn builder() -> StatsBuilder<stats_state::Empty, S> {
        StatsBuilder::builder()
    }
}

impl StatsBuilder<stats_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        StatsBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> StatsBuilder<stats_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        StatsBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> StatsBuilder<St, S>
where
    St: stats_state::State,
    St::CreatedAt: stats_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> StatsBuilder<stats_state::SetCreatedAt<St>, S> {
        self._fields.0 = Option::Some(value.into());
        StatsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: stats_state::State, S: BosStr> StatsBuilder<St, S> {
    /// Set the `custom` field (optional)
    pub fn custom(mut self, value: impl Into<Option<stats::CustomStats<S>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `custom` field to an Option value (optional)
    pub fn maybe_custom(mut self, value: Option<stats::CustomStats<S>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: stats_state::State, S: BosStr> StatsBuilder<St, S> {
    /// Set the `dcc` field (optional)
    pub fn dcc(mut self, value: impl Into<Option<stats::DccStats<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `dcc` field to an Option value (optional)
    pub fn maybe_dcc(mut self, value: Option<stats::DccStats<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: stats_state::State, S: BosStr> StatsBuilder<St, S> {
    /// Set the `dnd` field (optional)
    pub fn dnd(mut self, value: impl Into<Option<stats::DndStats<S>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `dnd` field to an Option value (optional)
    pub fn maybe_dnd(mut self, value: Option<stats::DndStats<S>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St: stats_state::State, S: BosStr> StatsBuilder<St, S> {
    /// Set the `reverie` field (optional)
    pub fn reverie(mut self, value: impl Into<Option<stats::ReverieStats<S>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `reverie` field to an Option value (optional)
    pub fn maybe_reverie(mut self, value: Option<stats::ReverieStats<S>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St: stats_state::State, S: BosStr> StatsBuilder<St, S> {
    /// Set the `rmmz` field (optional)
    pub fn rmmz(mut self, value: impl Into<Option<stats::RmmzStats<S>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `rmmz` field to an Option value (optional)
    pub fn maybe_rmmz(mut self, value: Option<stats::RmmzStats<S>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: stats_state::State, S: BosStr> StatsBuilder<St, S> {
    /// Set the `updatedAt` field (optional)
    pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `updatedAt` field to an Option value (optional)
    pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St, S: BosStr> StatsBuilder<St, S>
where
    St: stats_state::State,
    St::CreatedAt: stats_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Stats<S> {
        Stats {
            created_at: self._fields.0.unwrap(),
            custom: self._fields.1,
            dcc: self._fields.2,
            dnd: self._fields.3,
            reverie: self._fields.4,
            rmmz: self._fields.5,
            updated_at: self._fields.6,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Stats<S> {
        Stats {
            created_at: self._fields.0.unwrap(),
            custom: self._fields.1,
            dcc: self._fields.2,
            dnd: self._fields.3,
            reverie: self._fields.4,
            rmmz: self._fields.5,
            updated_at: self._fields.6,
            extra_data: Some(extra_data),
        }
    }
}

pub mod spellslot_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 Level;
        type Total;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Level = Unset;
        type Total = Unset;
    }
    ///State transition - sets the `level` field to Set
    pub struct SetLevel<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLevel<St> {}
    impl<St: State> State for SetLevel<St> {
        type Level = Set<members::level>;
        type Total = St::Total;
    }
    ///State transition - sets the `total` field to Set
    pub struct SetTotal<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTotal<St> {}
    impl<St: State> State for SetTotal<St> {
        type Level = St::Level;
        type Total = Set<members::total>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `level` field
        pub struct level(());
        ///Marker type for the `total` field
        pub struct total(());
    }
}

/// Builder for constructing an instance of this type.
pub struct SpellslotBuilder<St: spellslot_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<i64>, Option<i64>, Option<i64>),
    _type: PhantomData<fn() -> S>,
}

impl Spellslot<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> SpellslotBuilder<spellslot_state::Empty, DefaultStr> {
        SpellslotBuilder::new()
    }
}

impl<S: BosStr> Spellslot<S> {
    /// Create a new builder for this type
    pub fn builder() -> SpellslotBuilder<spellslot_state::Empty, S> {
        SpellslotBuilder::builder()
    }
}

impl SpellslotBuilder<spellslot_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        SpellslotBuilder {
            _state: PhantomData,
            _fields: (None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> SpellslotBuilder<spellslot_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        SpellslotBuilder {
            _state: PhantomData,
            _fields: (None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SpellslotBuilder<St, S>
where
    St: spellslot_state::State,
    St::Level: spellslot_state::IsUnset,
{
    /// Set the `level` field (required)
    pub fn level(
        mut self,
        value: impl Into<i64>,
    ) -> SpellslotBuilder<spellslot_state::SetLevel<St>, S> {
        self._fields.0 = Option::Some(value.into());
        SpellslotBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SpellslotBuilder<St, S>
where
    St: spellslot_state::State,
    St::Total: spellslot_state::IsUnset,
{
    /// Set the `total` field (required)
    pub fn total(
        mut self,
        value: impl Into<i64>,
    ) -> SpellslotBuilder<spellslot_state::SetTotal<St>, S> {
        self._fields.1 = Option::Some(value.into());
        SpellslotBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: spellslot_state::State, S: BosStr> SpellslotBuilder<St, S> {
    /// Set the `used` field (optional)
    pub fn used(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `used` field to an Option value (optional)
    pub fn maybe_used(mut self, value: Option<i64>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> SpellslotBuilder<St, S>
where
    St: spellslot_state::State,
    St::Level: spellslot_state::IsSet,
    St::Total: spellslot_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Spellslot<S> {
        Spellslot {
            level: self._fields.0.unwrap(),
            total: self._fields.1.unwrap(),
            used: self._fields.2,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> Spellslot<S> {
        Spellslot {
            level: self._fields.0.unwrap(),
            total: self._fields.1.unwrap(),
            used: self._fields.2,
            extra_data: Some(extra_data),
        }
    }
}