/** * Base Schema Definitions - Reusable Zod field patterns * * This module provides centralized, reusable schema definitions for common * patterns across the RPG-MCP schema system. Using these reduces duplication, * ensures consistency, and makes it easier to update validation rules globally. * * USAGE: * ```typescript * import { IdField, TimestampFields, GridCoordinates } from './base-schemas.js'; * * const MySchema = z.object({ * id: IdField, * ...TimestampFields, * position: GridCoordinates, * }); * ``` * * @module schema/base-schemas */ import { z } from 'zod'; /** * Standard string ID field (for entities that use string IDs) */ export declare const IdField: z.ZodString; /** * UUID field (for entities that use UUIDs) */ export declare const UuidField: z.ZodString; /** * World ID reference field */ export declare const WorldIdField: z.ZodString; /** * Region ID reference field (optional for entities that may not be region-linked) */ export declare const RegionIdField: z.ZodOptional; /** * Character ID reference field */ export declare const CharacterIdField: z.ZodString; /** * ISO 8601 datetime field */ export declare const DateTimeField: z.ZodString; /** * Spread into object schemas that need createdAt/updatedAt * * @example * const MySchema = z.object({ * id: IdField, * name: z.string(), * ...TimestampFields * }); */ export declare const TimestampFields: { readonly createdAt: z.ZodString; readonly updatedAt: z.ZodString; }; /** * Optional lastVisitedAt timestamp for trackable entities */ export declare const LastVisitedField: z.ZodOptional; /** * World grid X coordinate (0 to world width) */ export declare const GridXField: z.ZodNumber; /** * World grid Y coordinate (0 to world height) */ export declare const GridYField: z.ZodNumber; /** * Standard 2D grid coordinates */ export declare const GridCoordinates: z.ZodObject<{ x: z.ZodNumber; y: z.ZodNumber; }, "strip", z.ZodTypeAny, { x: number; y: number; }, { x: number; y: number; }>; /** * Combat/tactical position (allows floating point for precise positioning) */ export declare const TacticalPosition: z.ZodObject<{ x: z.ZodNumber; y: z.ZodNumber; z: z.ZodOptional; }, "strip", z.ZodTypeAny, { x: number; y: number; z?: number | undefined; }, { x: number; y: number; z?: number | undefined; }>; export type TacticalPositionType = z.infer; /** * Bounding box for spatial queries */ export declare const BoundingBox: z.ZodObject<{ minX: z.ZodNumber; maxX: z.ZodNumber; minY: z.ZodNumber; maxY: z.ZodNumber; }, "strip", z.ZodTypeAny, { minX: number; maxX: number; minY: number; maxY: number; }, { minX: number; maxX: number; minY: number; maxY: number; }>; export type BoundingBoxType = z.infer; /** * Entity name field with validation */ export declare const NameField: z.ZodEffects; /** * Short description field (for tooltips, summaries) */ export declare const ShortDescriptionField: z.ZodOptional; /** * Long description field (for detailed content) */ export declare const LongDescriptionField: z.ZodEffects; /** * Non-negative integer (0+) */ export declare const NonNegativeInt: z.ZodNumber; /** * Positive integer (1+) */ export declare const PositiveInt: z.ZodNumber; /** * Population field for settlements */ export declare const PopulationField: z.ZodNumber; /** * Character level (1-20 for standard D&D) */ export declare const LevelField: z.ZodNumber; /** * Difficulty Class field (5-30 standard range) */ export declare const DCField: z.ZodNumber; /** * HP field (0+) */ export declare const HpField: z.ZodNumber; /** * AC field (0+) */ export declare const AcField: z.ZodNumber; /** * Percentage field (0-1 as decimal) */ export declare const PercentageField: z.ZodNumber; /** * Percentage field (0-100 as integer) */ export declare const PercentageInt: z.ZodNumber; /** * Single ability score (typically 1-30) */ export declare const AbilityScoreField: z.ZodNumber; /** * Standard D&D ability score object */ export declare const AbilityScores: z.ZodObject<{ str: z.ZodNumber; dex: z.ZodNumber; con: z.ZodNumber; int: z.ZodNumber; wis: z.ZodNumber; cha: z.ZodNumber; }, "strip", z.ZodTypeAny, { str: number; dex: number; con: number; int: number; wis: number; cha: number; }, { str: number; dex: number; con: number; int: number; wis: number; cha: number; }>; export type AbilityScoresType = z.infer; /** * Save proficiency enum */ export declare const SaveProficiencyEnum: z.ZodEnum<["str", "dex", "con", "int", "wis", "cha"]>; /** * Skill proficiency enum */ export declare const SkillProficiencyEnum: z.ZodEnum<["acrobatics", "animal_handling", "arcana", "athletics", "deception", "history", "insight", "intimidation", "investigation", "medicine", "nature", "perception", "performance", "persuasion", "religion", "sleight_of_hand", "stealth", "survival"]>; /** * D&D 5e size categories * Note: Named BaseSizeCategory to avoid conflict with encounter.ts SizeCategory */ export declare const BaseSizeCategory: z.ZodEnum<["tiny", "small", "medium", "large", "huge", "gargantuan"]>; export type BaseSizeCategoryType = z.infer; /** * Standard damage types in D&D 5e * Note: Named BaseDamageType to avoid conflict with spell.ts DamageType */ export declare const BaseDamageTypeEnum: z.ZodEnum<["slashing", "piercing", "bludgeoning", "fire", "cold", "lightning", "thunder", "acid", "poison", "necrotic", "radiant", "psychic", "force"]>; export type BaseDamageType = z.infer; /** * Array of damage types (for resistances, immunities, vulnerabilities) */ export declare const BaseDamageTypeArray: z.ZodDefault, "many">>; /** * Condition type enum */ export declare const ConditionTypeEnum: z.ZodEnum<["blinded", "charmed", "deafened", "frightened", "grappled", "incapacitated", "invisible", "paralyzed", "petrified", "poisoned", "prone", "restrained", "stunned", "unconscious", "exhaustion"]>; export type ConditionType = z.infer; /** * Standard D&D currency object */ export declare const CurrencyFields: z.ZodDefault; silver: z.ZodDefault; copper: z.ZodDefault; }, "strip", z.ZodTypeAny, { gold: number; silver: number; copper: number; }, { gold?: number | undefined; silver?: number | undefined; copper?: number | undefined; }>>; export type CurrencyType = z.infer; /** * Encounter status enum */ export declare const EncounterStatusEnum: z.ZodEnum<["active", "completed", "paused"]>; /** * Movement speed field (in feet, default 30) */ export declare const MovementSpeedField: z.ZodDefault; /** * Initiative bonus field */ export declare const InitiativeBonusField: z.ZodNumber; /** * Discovery state for POIs and secrets */ export declare const DiscoveryStateEnum: z.ZodEnum<["unknown", "rumored", "discovered", "explored", "mapped"]>; export type DiscoveryState = z.infer; /** * Cardinal and vertical directions */ export declare const DirectionEnum: z.ZodEnum<["north", "south", "east", "west", "up", "down", "northeast", "northwest", "southeast", "southwest"]>; export type Direction = z.infer; /** * Exit/door types */ export declare const ExitTypeEnum: z.ZodEnum<["OPEN", "LOCKED", "HIDDEN"]>; /** * Cover types for combat props */ export declare const CoverTypeEnum: z.ZodEnum<["none", "half", "three_quarter", "full"]>; /** * Create a standard entity schema with ID and timestamps * @param fields - Additional fields for the entity * @returns Combined Zod object schema * * @example * const MyEntitySchema = createEntitySchema({ * name: NameField, * value: NonNegativeInt, * }); */ export declare function createEntitySchema(fields: T): z.ZodObject<{ id: z.ZodString; } & T & { readonly createdAt: z.ZodString; readonly updatedAt: z.ZodString; }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{ id: z.ZodString; } & T & { readonly createdAt: z.ZodString; readonly updatedAt: z.ZodString; }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>; /** * Create a standard entity schema with UUID and timestamps * @param fields - Additional fields for the entity * @returns Combined Zod object schema */ export declare function createUuidEntitySchema(fields: T): z.ZodObject<{ id: z.ZodString; } & T & { readonly createdAt: z.ZodString; readonly updatedAt: z.ZodString; }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{ id: z.ZodString; } & T & { readonly createdAt: z.ZodString; readonly updatedAt: z.ZodString; }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>; /** * Create a world-linked entity schema with worldId, optional regionId, coordinates * @param fields - Additional fields for the entity * @returns Combined Zod object schema * * @example * const StructureSchema = createWorldEntitySchema({ * name: NameField, * type: z.enum(['city', 'town', 'village']), * population: PopulationField, * }); */ export declare function createWorldEntitySchema(fields: T): z.ZodObject<{ id: z.ZodString; worldId: z.ZodString; regionId: z.ZodOptional; x: z.ZodNumber; y: z.ZodNumber; } & T & { readonly createdAt: z.ZodString; readonly updatedAt: z.ZodString; }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks; x: z.ZodNumber; y: z.ZodNumber; } & T & { readonly createdAt: z.ZodString; readonly updatedAt: z.ZodString; }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{ id: z.ZodString; worldId: z.ZodString; regionId: z.ZodOptional; x: z.ZodNumber; y: z.ZodNumber; } & T & { readonly createdAt: z.ZodString; readonly updatedAt: z.ZodString; }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>; //# sourceMappingURL=base-schemas.d.ts.map