@wildo-ai/zod-decorators 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/.native.tsbuildinfo +1 -0
- package/dist/esm/currencies.shared.schemas.d.ts +16 -0
- package/dist/esm/currencies.shared.schemas.d.ts.map +1 -1
- package/dist/esm/currencies.shared.schemas.js +99 -0
- package/dist/esm/currencies.shared.schemas.js.map +1 -1
- package/dist/esm/zod-decorators.types.d.ts +259 -34
- package/dist/esm/zod-decorators.types.d.ts.map +1 -1
- package/dist/esm/zod-decorators.types.js +125 -8
- package/dist/esm/zod-decorators.types.js.map +1 -1
- package/dist/esm/zod-file.d.ts +30 -0
- package/dist/esm/zod-file.d.ts.map +1 -1
- package/dist/esm/zod-file.js +39 -5
- package/dist/esm/zod-file.js.map +1 -1
- package/dist/esm/zod-money.d.ts +51 -0
- package/dist/esm/zod-money.d.ts.map +1 -1
- package/dist/esm/zod-money.js +81 -1
- package/dist/esm/zod-money.js.map +1 -1
- package/dist/esm/zod-utils.shared.d.ts +43 -0
- package/dist/esm/zod-utils.shared.d.ts.map +1 -1
- package/dist/esm/zod-utils.shared.js +147 -1
- package/dist/esm/zod-utils.shared.js.map +1 -1
- package/dist/esm/zod.module-override.d.ts +34 -0
- package/dist/esm/zod.module-override.d.ts.map +1 -1
- package/dist/esm/zod.module-override.js +76 -5
- package/dist/esm/zod.module-override.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/esm/.builder.pid +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-decorators.types.js","sourceRoot":"","sources":["../../../src/zod-decorators.types.ts"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAW,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACrE,4DAA4D;AAI5D,kDAAkD;AAClD,yEAAyE;AAE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AC5B,CAAC,EA5NW,YAAY,KAAZ,YAAY,QA4NvB","sourcesContent":["import type { ComponentType } from 'react';\nimport type { CountryCode as LibPhoneNumberCountryCode } from 'libphonenumber-js';\nimport { Breakpoint, ViewportBreakpoint } from './commons';\nimport { AvailableCurrency, CurrencyAllowed } from './currencies.shared.schemas';\nimport { z } from 'zod';\nimport { DecoratedPrimitiveZodType } from './zod.module-override';\nimport { ZodBrandedColorInstance, ZodTypeForColors } from './zod-color';\n\n\n/**\n * @wildo_source:part:start zod.decorators.schema-metadata\n *\n * Internal metadata key used by Wildo's schema decorators.\n *\n * Application schemas obtain this metadata by using the supported decorators\n * and schema factories from `@wildo-ai/zod-decorators`; application code must\n * not write this symbol directly. `Symbol.for()` keeps independently loaded\n * package copies interoperable while the framework reads the schema contract.\n */\nexport const SCHEMA_METADATA: symbol = Symbol.for('schema_metadata');\n/** @wildo_source:part:end zod.decorators.schema-metadata */\n\n\n\n// Schema type categories for component selection.\n// Represents the underlying Zod schema type detected from introspection.\n\nexport enum FieldSchemaType {\n STRING = 'string', // String schemas (z.string)\n NUMBER = 'number', // Number schemas (z.number, z.int)\n BIGINT = 'bigint', // BigInt schemas (z.bigint)\n BOOLEAN = 'boolean', // Boolean schemas (z.boolean)\n ENUM = 'enum', // Enum schemas (z.enum, z.enum)\n DATE = 'date', // Date schemas (z.date)\n OBJECT = 'object', // Object schemas (z.object) - NOT range schemas\n ARRAY = 'array', // Array schemas (z.array)\n SET = 'set', // Set schemas (z.set) - stored as array\n TUPLE = 'tuple', // Tuple schemas (z.tuple)\n RECORD = 'record', // Record schemas (z.record)\n MAP = 'map', // Map schemas (z.map)\n TIME = 'time', // Time schemas (z.time)\n DATETIME = 'datetime', // Datetime schemas (z.datetime)\n RANGE_NUMBER = 'range_number', // Range number schemas created by z_range('number')\n RANGE_DATE = 'range_date', // Range date schemas created by z_range('date')\n RANGE_DATETIME = 'range_datetime', // Range datetime schemas created by z_range('datetime')\n RANGE_TIME = 'range_time', // Range time schemas created by z_range('time')\n RANGE_BIGDECIMAL = 'range_bigdecimal', // Range bigdecimal schemas created by z_range('bigdecimal')\n RANGE_MONEY = 'range_money', // Range money schemas created by z_range('money')\n MONEY = 'money', // Money schemas created by z_money() - detected by SCHEMA_METADATA.moneyConfig\n BIGDECIMAL = 'bigdecimal', // BigDecimal schemas created by z_bigdecimal() - detected by SCHEMA_METADATA.bigDecimalConfig\n CODE = 'code', // Code schemas created by z_code() - detected by SCHEMA_METADATA.codeConfig\n FILE = 'file', // File schemas created by z_file() - detected by SCHEMA_METADATA.fileConfig\n DURATION = 'duration', // Duration schemas created by z_duration() - detected by SCHEMA_METADATA.durationConfig\n PHONE = 'phone', // Phone schemas created by z_phone() - detected by SCHEMA_METADATA.phoneConfig\n VERSIONED_FOREIGN_KEY = 'versioned_foreign_key', // Versioned foreign key schemas created by z_foreignKeyVersioned() - detected by SCHEMA_METADATA.versionedForeignKeyConfig\n VERSIONED_OBJECT = 'versioned_object', // Versioned object schemas created by versioned() - detected by SCHEMA_METADATA.versionedConfig\n UNKNOWN = 'unknown', // Unknown or unsupported schema type\n}\n\n///=======================================================================================================================\n/// FORM FIELD COMPONENT TYPES\n///=======================================================================================================================\n\n// Form field component types.\n// Represents the UI component that should render a form field.\nexport enum FormFieldComponent {\n INPUT = 'input', // Standard text input\n TEXTAREA = 'textarea', // Multi-line text area\n SELECT = 'select', // Dropdown select\n RADIO_GROUP = 'radio-group', // Radio button group\n CHECKBOX = 'checkbox', // Single checkbox\n CHECKBOX_GROUP = 'checkbox-group', // Checkbox group for multi-select (arrays of enums)\n SWITCH = 'switch', // Toggle switch\n SLIDER = 'slider', // Single value slider\n DATE = 'date', // Date picker (single date)\n TIME = 'time', // Time picker (single time)\n DATETIME = 'datetime', // DateTime picker (date + time)\n RANGE_SLIDER = 'range-slider', // Number range slider (two thumbs for min/max)\n DATE_RANGE = 'date-range', // Date range picker (from/to dates)\n DATETIME_RANGE = 'datetime-range', // DateTime range picker (from/to datetime)\n TIME_RANGE = 'time-range', // Time range picker (from/to time)\n BIGDECIMAL_RANGE = 'bigdecimal-range', // BigDecimal range input (from/to bigdecimal)\n MONEY_RANGE = 'money-range', // Money range input (from/to money)\n DURATION = 'duration', // Duration input (value + unit selector)\n PHONE = 'phone', // Phone input (country + number, E.164 output)\n}\n\n// ================================\n// HTML AUTOCOMPLETE TOKENS\n// ================================\n\n/**\n * Official HTML autocomplete field identifiers.\n * Excludes `section-*`, `on`, and `off` because the decorator contract here is\n * focused on typed semantic field tokens rather than raw form-level switches.\n */\nexport enum AutocompleteFieldIdentifier {\n NAME = 'name',\n HONORIFIC_PREFIX = 'honorific-prefix',\n GIVEN_NAME = 'given-name',\n ADDITIONAL_NAME = 'additional-name',\n FAMILY_NAME = 'family-name',\n HONORIFIC_SUFFIX = 'honorific-suffix',\n NICKNAME = 'nickname',\n USERNAME = 'username',\n NEW_PASSWORD = 'new-password',\n CURRENT_PASSWORD = 'current-password',\n ONE_TIME_CODE = 'one-time-code',\n ORGANIZATION_TITLE = 'organization-title',\n ORGANIZATION = 'organization',\n STREET_ADDRESS = 'street-address',\n ADDRESS_LINE_1 = 'address-line1',\n ADDRESS_LINE_2 = 'address-line2',\n ADDRESS_LINE_3 = 'address-line3',\n ADDRESS_LEVEL_4 = 'address-level4',\n ADDRESS_LEVEL_3 = 'address-level3',\n ADDRESS_LEVEL_2 = 'address-level2',\n ADDRESS_LEVEL_1 = 'address-level1',\n COUNTRY = 'country',\n COUNTRY_NAME = 'country-name',\n POSTAL_CODE = 'postal-code',\n CC_NAME = 'cc-name',\n CC_GIVEN_NAME = 'cc-given-name',\n CC_ADDITIONAL_NAME = 'cc-additional-name',\n CC_FAMILY_NAME = 'cc-family-name',\n CC_NUMBER = 'cc-number',\n CC_EXP = 'cc-exp',\n CC_EXP_MONTH = 'cc-exp-month',\n CC_EXP_YEAR = 'cc-exp-year',\n CC_CSC = 'cc-csc',\n CC_TYPE = 'cc-type',\n TRANSACTION_CURRENCY = 'transaction-currency',\n TRANSACTION_AMOUNT = 'transaction-amount',\n LANGUAGE = 'language',\n BDAY = 'bday',\n BDAY_DAY = 'bday-day',\n BDAY_MONTH = 'bday-month',\n BDAY_YEAR = 'bday-year',\n SEX = 'sex',\n URL = 'url',\n PHOTO = 'photo',\n TEL = 'tel',\n TEL_COUNTRY_CODE = 'tel-country-code',\n TEL_NATIONAL = 'tel-national',\n TEL_AREA_CODE = 'tel-area-code',\n TEL_LOCAL = 'tel-local',\n TEL_LOCAL_PREFIX = 'tel-local-prefix',\n TEL_LOCAL_SUFFIX = 'tel-local-suffix',\n TEL_EXTENSION = 'tel-extension',\n EMAIL = 'email',\n IMPP = 'impp',\n}\n\n/**\n * Official non-`section-*` HTML autocomplete modifiers.\n * Rendering code is responsible for placing them in spec order.\n */\nexport enum AutocompleteModifier {\n SHIPPING = 'shipping',\n BILLING = 'billing',\n HOME = 'home',\n WORK = 'work',\n MOBILE = 'mobile',\n FAX = 'fax',\n PAGER = 'pager',\n WEBAUTHN = 'webauthn',\n}\n\n\n// ================================\n// FORM FIELD CHROME MODES\n// ================================\n\n//------------------------------------------------------------------------------------------------\n// CHROME MODES — display and edit context\n//------------------------------------------------------------------------------------------------\n\n/**\n * Chrome layout mode for display context (detail/read-only views).\n * Controls how the field wrapper (label, value, description) is arranged.\n */\nexport const DisplayChromeMode = {\n /** Label above, value below, description below value (default). */\n STACKED: 'stacked',\n /**\n * Label + description inline-start, value inline-end (settings page style).\n * The read-mode counterpart of `EditChromeMode.SETTINGS_ROW` — pairing the two\n * keeps a view→edit drill (e.g. inside the Settings Hub) visually coherent: the\n * value sits where its control will appear.\n */\n SETTINGS_ROW: 'settings_row',\n /** Label and value on the same line. */\n INLINE: 'inline',\n /** No label/description, just value (dense mode). */\n COMPACT: 'compact',\n /** No chrome at all — bare value output. */\n HIDDEN: 'hidden',\n} as const;\nexport type DisplayChromeMode = typeof DisplayChromeMode[keyof typeof DisplayChromeMode];\n\n/**\n * Chrome layout mode for edit context (forms).\n * Superset of DisplayChromeMode with form-specific modes (SETTINGS_ROW, RELAXED).\n */\nexport const EditChromeMode = {\n /** Label above, control below, description + error below control (default). */\n STACKED: 'stacked',\n /** Label + description left, control + error right (settings page style). */\n SETTINGS_ROW: 'settings_row',\n /** Control left, label + description right (switch/checkbox style). */\n INLINE: 'inline',\n /** Generous spacing, heading-size label (onboarding, OTP, wizard). */\n RELAXED: 'relaxed',\n /** No label/description, just control + error (dense mode). */\n COMPACT: 'compact',\n /** No chrome at all — bare control output. */\n HIDDEN: 'hidden',\n} as const;\nexport type EditChromeMode = typeof EditChromeMode[keyof typeof EditChromeMode];\n\n/**\n * Responsive chrome mode — either a single mode or per-breakpoint mapping.\n * When a breakpoint mapping is provided, FormFieldChrome resolves the effective\n * mode at runtime using useUI().\n */\nexport type ResponsiveChromeMode = EditChromeMode | Partial<Record<ViewportBreakpoint, EditChromeMode>>;\n\n/**\n * Responsive-aware value: either a single value or per-breakpoint overrides.\n * Used for chromeMode, forceHide, and other properties that may vary by viewport.\n */\nexport type ResponsiveAware<T> = T | Partial<Record<ViewportBreakpoint, T>>;\n\n\n// Compatible components for each schema type.\n// Provides compile-time type safety for component selection.\nexport type FormFieldSchemaTypeComponents = {\n // Use a mapped type so keys are truly `FieldSchemaType` (fixes TS2536 indexing errors).\n [K in FieldSchemaType]:\n K extends FieldSchemaType.STRING\n ? FormFieldComponent.INPUT\n | FormFieldComponent.TEXTAREA\n | FormFieldComponent.SELECT\n | FormFieldComponent.RADIO_GROUP\n | FormFieldComponent.DATE\n | FormFieldComponent.TIME\n | FormFieldComponent.DATETIME\n : K extends FieldSchemaType.NUMBER\n ? FormFieldComponent.INPUT\n | FormFieldComponent.SLIDER\n | FormFieldComponent.SELECT\n | FormFieldComponent.RADIO_GROUP\n : K extends FieldSchemaType.BIGINT\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.BOOLEAN\n ? FormFieldComponent.SWITCH\n | FormFieldComponent.CHECKBOX\n | FormFieldComponent.SELECT\n | FormFieldComponent.RADIO_GROUP\n : K extends FieldSchemaType.ENUM\n ? FormFieldComponent.SELECT\n | FormFieldComponent.RADIO_GROUP\n : K extends FieldSchemaType.DATE\n ? FormFieldComponent.DATE\n | FormFieldComponent.DATETIME\n | FormFieldComponent.INPUT\n : K extends FieldSchemaType.TIME\n ? FormFieldComponent.TIME\n | FormFieldComponent.INPUT\n : K extends FieldSchemaType.DATETIME\n ? FormFieldComponent.DATETIME\n | FormFieldComponent.INPUT\n : K extends FieldSchemaType.RANGE_NUMBER\n ? FormFieldComponent.RANGE_SLIDER\n : K extends FieldSchemaType.RANGE_DATE\n ? FormFieldComponent.DATE_RANGE\n : K extends FieldSchemaType.RANGE_DATETIME\n ? FormFieldComponent.DATETIME_RANGE\n : K extends FieldSchemaType.RANGE_TIME\n ? FormFieldComponent.TIME_RANGE\n : K extends FieldSchemaType.RANGE_BIGDECIMAL\n ? FormFieldComponent.BIGDECIMAL_RANGE\n : K extends FieldSchemaType.RANGE_MONEY\n ? FormFieldComponent.MONEY_RANGE\n : K extends FieldSchemaType.MONEY\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.DURATION\n ? FormFieldComponent.DURATION\n : K extends FieldSchemaType.PHONE\n ? FormFieldComponent.PHONE\n : K extends FieldSchemaType.BIGDECIMAL\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.CODE\n ? FormFieldComponent.TEXTAREA\n : K extends FieldSchemaType.FILE\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.ARRAY\n ? FormFieldComponent.CHECKBOX_GROUP // For arrays of enums (multi-select)\n | FormFieldComponent.SELECT // For arrays rendered as multi-select dropdown\n : K extends FieldSchemaType.SET\n ? FormFieldComponent.INPUT\n | FormFieldComponent.CHECKBOX_GROUP // For sets of enums (multi-select)\n | FormFieldComponent.SELECT // For sets rendered as multi-select dropdown\n : K extends FieldSchemaType.TUPLE\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.UNKNOWN\n ? FormFieldComponent.INPUT\n : never;\n};\n\n// Get compatible component type for a schema type.\n// Use this for type-safe component assignment.\nexport type FormComponentForSchemaType<T extends FieldSchemaType> = FormFieldSchemaTypeComponents[T];\n\n// Default component for each schema type.\nexport type FormFieldSchemaTypeDefaultComponent = {\n [K in FieldSchemaType]:\n K extends FieldSchemaType.STRING ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.NUMBER ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.BIGINT ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.BOOLEAN ? FormFieldComponent.SWITCH\n : K extends FieldSchemaType.ENUM ? FormFieldComponent.SELECT\n : K extends FieldSchemaType.DATE ? FormFieldComponent.DATE\n : K extends FieldSchemaType.TIME ? FormFieldComponent.TIME\n : K extends FieldSchemaType.DATETIME ? FormFieldComponent.DATETIME\n : K extends FieldSchemaType.RANGE_NUMBER ? FormFieldComponent.RANGE_SLIDER\n : K extends FieldSchemaType.RANGE_DATE ? FormFieldComponent.DATE_RANGE\n : K extends FieldSchemaType.RANGE_DATETIME ? FormFieldComponent.DATETIME_RANGE\n : K extends FieldSchemaType.RANGE_TIME ? FormFieldComponent.TIME_RANGE\n : K extends FieldSchemaType.RANGE_BIGDECIMAL ? FormFieldComponent.BIGDECIMAL_RANGE\n : K extends FieldSchemaType.RANGE_MONEY ? FormFieldComponent.MONEY_RANGE\n : K extends FieldSchemaType.MONEY ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.DURATION ? FormFieldComponent.DURATION\n : K extends FieldSchemaType.PHONE ? FormFieldComponent.PHONE\n : K extends FieldSchemaType.BIGDECIMAL ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.CODE ? FormFieldComponent.TEXTAREA\n : K extends FieldSchemaType.FILE ? FormFieldComponent.INPUT\n : FormFieldComponent.INPUT;\n};\n\n// Get default component type for a schema type.\nexport type DefaultFormComponentForSchemaType<T extends FieldSchemaType> = FormFieldSchemaTypeDefaultComponent[T];\n\n\n\n// Decorator configuration types\nexport type DecoratorConfig<T extends ZodDecorator> = {\n ref: T;\n params: ZodDecorator_ParamsType[T];\n};\n\nexport type DecoratorInput<T extends ZodDecorator = ZodDecorator> =\n | T\n | DecoratorConfig<T>;\n\n\n\n///=======================================================================================================================\n/// DISPLAY FIELD COMPONENT TYPES\n///=======================================================================================================================\n\nexport enum DisplayFieldComponent {\n // Basic/fallback\n SIMPLE_TEXT = 'simple-text',\n\n // Primitive types\n STRING = 'string',\n NUMBER = 'number',\n BOOLEAN = 'boolean',\n ENUM = 'enum',\n\n // Date/Time types\n DATE = 'date',\n TIME = 'time',\n DATETIME = 'datetime',\n\n // Special primitive types\n CODE = 'code',\n FILE = 'file',\n MONEY = 'money',\n BIGDECIMAL = 'bigdecimal',\n DURATION = 'duration',\n PHONE = 'phone',\n\n // Range types\n RANGE_NUMBER = 'range-number',\n RANGE_DATE = 'range-date',\n RANGE_TIME = 'range-time',\n RANGE_DATETIME = 'range-datetime',\n RANGE_BIGDECIMAL = 'range-bigdecimal',\n RANGE_MONEY = 'range-money',\n}\n\n// Compatible display components for each schema type.\n// Provides compile-time type safety for display component selection.\nexport type DisplayFieldSchemaTypeComponents = {\n // Use a mapped type so keys are truly `FieldSchemaType` (fixes TS2536 indexing errors).\n [K in FieldSchemaType]:\n K extends FieldSchemaType.STRING\n ? DisplayFieldComponent.STRING | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.NUMBER\n ? DisplayFieldComponent.NUMBER | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.BIGINT\n ? DisplayFieldComponent.NUMBER | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.BOOLEAN\n ? DisplayFieldComponent.BOOLEAN | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.ENUM\n ? DisplayFieldComponent.ENUM | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.DATE\n ? DisplayFieldComponent.DATE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.TIME\n ? DisplayFieldComponent.TIME | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.DATETIME\n ? DisplayFieldComponent.DATETIME | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.OBJECT\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.ARRAY\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RECORD\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.MAP\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_NUMBER\n ? DisplayFieldComponent.RANGE_NUMBER | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_DATE\n ? DisplayFieldComponent.RANGE_DATE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_TIME\n ? DisplayFieldComponent.RANGE_TIME | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_DATETIME\n ? DisplayFieldComponent.RANGE_DATETIME | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_BIGDECIMAL\n ? DisplayFieldComponent.RANGE_BIGDECIMAL | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_MONEY\n ? DisplayFieldComponent.RANGE_MONEY | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.MONEY\n ? DisplayFieldComponent.MONEY | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.DURATION\n ? DisplayFieldComponent.DURATION | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.PHONE\n ? DisplayFieldComponent.PHONE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.BIGDECIMAL\n ? DisplayFieldComponent.BIGDECIMAL | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.CODE\n ? DisplayFieldComponent.CODE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.FILE\n ? DisplayFieldComponent.FILE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.SET\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.TUPLE\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.VERSIONED_FOREIGN_KEY\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.VERSIONED_OBJECT\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.UNKNOWN\n ? DisplayFieldComponent.SIMPLE_TEXT\n : never;\n};\n\n// Get compatible display component type for a schema type.\n// Use this for type-safe display component assignment.\nexport type DisplayComponentForSchemaType<T extends FieldSchemaType> = DisplayFieldSchemaTypeComponents[T];\n\n// Default display component for each schema type.\nexport type DisplayFieldSchemaTypeDefaultComponent = {\n [K in FieldSchemaType]:\n K extends FieldSchemaType.STRING ? DisplayFieldComponent.STRING\n : K extends FieldSchemaType.NUMBER ? DisplayFieldComponent.NUMBER\n : K extends FieldSchemaType.BIGINT ? DisplayFieldComponent.NUMBER\n : K extends FieldSchemaType.BOOLEAN ? DisplayFieldComponent.BOOLEAN\n : K extends FieldSchemaType.ENUM ? DisplayFieldComponent.ENUM\n : K extends FieldSchemaType.DATE ? DisplayFieldComponent.DATE\n : K extends FieldSchemaType.TIME ? DisplayFieldComponent.TIME\n : K extends FieldSchemaType.DATETIME ? DisplayFieldComponent.DATETIME\n : K extends FieldSchemaType.OBJECT ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.ARRAY ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RECORD ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.MAP ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_NUMBER ? DisplayFieldComponent.RANGE_NUMBER\n : K extends FieldSchemaType.RANGE_DATE ? DisplayFieldComponent.RANGE_DATE\n : K extends FieldSchemaType.RANGE_TIME ? DisplayFieldComponent.RANGE_TIME\n : K extends FieldSchemaType.RANGE_DATETIME ? DisplayFieldComponent.RANGE_DATETIME\n : K extends FieldSchemaType.RANGE_BIGDECIMAL ? DisplayFieldComponent.RANGE_BIGDECIMAL\n : K extends FieldSchemaType.RANGE_MONEY ? DisplayFieldComponent.RANGE_MONEY\n : K extends FieldSchemaType.MONEY ? DisplayFieldComponent.MONEY\n : K extends FieldSchemaType.DURATION ? DisplayFieldComponent.DURATION\n : K extends FieldSchemaType.PHONE ? DisplayFieldComponent.PHONE\n : K extends FieldSchemaType.BIGDECIMAL ? DisplayFieldComponent.BIGDECIMAL\n : K extends FieldSchemaType.CODE ? DisplayFieldComponent.CODE\n : K extends FieldSchemaType.FILE ? DisplayFieldComponent.FILE\n : K extends FieldSchemaType.SET ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.TUPLE ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.VERSIONED_FOREIGN_KEY ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.VERSIONED_OBJECT ? DisplayFieldComponent.SIMPLE_TEXT\n : DisplayFieldComponent.SIMPLE_TEXT;\n};\n\n// Get default display component type for a schema type.\nexport type DefaultDisplayComponentForSchemaType<T extends FieldSchemaType> = DisplayFieldSchemaTypeDefaultComponent[T];\n\n\n\n\n\n//------------------------------------------------------------------------------------------------\n// FORM FIELD\n//------------------------------------------------------------------------------------------------\n\n// =============================================================================\n// SECTION MODE - Unified enum for section rendering\n// =============================================================================\n\n/**\n * How a section is rendered — both per-section appearance and container grouping.\n *\n * **Solo modes** (render in place, no grouping):\n * - DEFAULT: Standard section with border and padding\n * - CARD: Wrapped in a card container with shadow\n * - GHOST: Minimal container without visual styling\n * - COLLAPSIBLE: Expandable/collapsible section with trigger\n *\n * **Container modes** (sections sharing the same mode are grouped together,\n * rendered at the position of the first occurrence):\n *\n * @category Layout-based (all sections visible simultaneously)\n * - INLINE: Stacked vertically\n * - GRID: CSS Grid layout with configurable columns\n * - COLUMNS: Multi-column layout (newspaper style)\n *\n * @category Navigation-based (one section visible at a time)\n * - TABS: Horizontal tabs navigation\n * - VERTICAL_TABS: Vertical tabs (side navigation)\n * - PILLS: Pill/segment navigation (compact)\n *\n * @category Expandable (toggle section visibility)\n * - ACCORDION: Each section independently collapsible\n * - EXPANDABLE: \"Show more\" button reveals additional sections\n *\n * @category Guided (sequential, with indicators)\n * - STEPPER: Step-by-step with step indicators\n * - TIMELINE: Chronological progression (vertical timeline)\n *\n * NOTE: Wizard is NOT included — it's a higher-level layout pattern\n * that contains sections, not a section rendering mode.\n */\nexport enum SectionMode {\n // Solo (render in place, no grouping)\n DEFAULT = 'default',\n CARD = 'card',\n GHOST = 'ghost',\n COLLAPSIBLE = 'collapsible',\n\n // Layout-based (all sections visible simultaneously)\n INLINE = 'inline',\n GRID = 'grid',\n COLUMNS = 'columns',\n\n // Navigation-based (one section visible at a time)\n TABS = 'tabs',\n VERTICAL_TABS = 'vertical_tabs',\n PILLS = 'pills',\n\n // Expandable (toggle section visibility)\n ACCORDION = 'accordion',\n EXPANDABLE = 'expandable',\n\n // Guided (sequential, with indicators)\n STEPPER = 'stepper',\n TIMELINE = 'timeline',\n}\n\n/** Solo modes — render in place, no grouping. Valid on `<Section appearance>`. */\nexport type SoloSectionMode =\n | SectionMode.DEFAULT\n | SectionMode.CARD\n | SectionMode.GHOST\n | SectionMode.COLLAPSIBLE;\n\n/** Container modes — sections sharing the same mode are grouped into one container. */\nexport type ContainerSectionMode = Exclude<SectionMode, SoloSectionMode>;\n\n// =============================================================================\n// OVERLAY CONTAINER MODE - UI Abstraction for Overlay Rendering\n// =============================================================================\n\n/**\n * OverlayContainerMode - How overlay containers are rendered.\n * Controls the presentation style of standalone dismissable containers.\n *\n * @category Centered overlays (modal)\n * - DIALOG: Standard centered modal\n * - ALERT: Confirmation dialog with action buttons\n * - COMMAND: Command palette (search-focused)\n * - LIGHTBOX: Full-screen media viewer with navigation\n *\n * @category Side panels (modal)\n * - SHEET: Side panel (direction via `side` prop)\n *\n * @category Mobile-optimized (modal)\n * - DRAWER: Swipeable drawer with snap points\n * - ACTION_SHEET: iOS-style action list (bottom)\n *\n * @category Non-blocking\n * - POPOVER: Anchored contextual overlay\n * - TOAST: Auto-dismiss notification\n */\nexport enum OverlayContainerMode {\n // Centered overlays (modal)\n DIALOG = 'dialog',\n ALERT = 'alert',\n COMMAND = 'command',\n LIGHTBOX = 'lightbox',\n\n // Side panels (modal)\n SHEET = 'sheet',\n\n // Mobile-optimized (modal)\n DRAWER = 'drawer',\n ACTION_SHEET = 'action_sheet',\n\n // Non-blocking\n POPOVER = 'popover',\n TOAST = 'toast',\n}\n\n/**\n * Layout orientation / display direction (horizontal | vertical)\n */\nexport enum DisplayDirection {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\n/**\n * Horizontal alignment for UI elements (popovers, menus, action bars, etc.)\n */\nexport enum HorizontalAlign {\n START = 'start',\n CENTER = 'center',\n END = 'end',\n}\n\n//------------------------------------------------------------------------------------------------\n/**\n * @wildo_source:part:start zod.decorators.display-edit-modes facet:layer:frontend facet:family:ui facet:surface:form facet:surface:display\n *\n * Frontend UI vocabulary for choosing how a field renders and edits.\n *\n * These values are not the persisted resource semantics themselves. They are\n * consumed by the frontend resource UI behavior layer, typically in\n * files like `frontend/src/modules/<module>/resources/<resource>/<resource>.ui-behavior.tsx`, where the AI\n * calls decorators like `.stringUI()`, `.enumUI()`, `.booleanUI()`, etc. on the\n * schema shape exposed to `resourceUIBehavior(...)`.\n *\n * Keep these mode enums in the framework source as the canonical list of\n * supported display/edit behaviors. Authoring skills and generated knowledge\n * should reference these definitions instead of copying literal mode tables\n * into markdown by hand.\n */\n// BOOLEAN DISPLAY POLICY\n//------------------------------------------------------------------------------------------------\n\n/**\n * Labelling values for boolean fields\n */\nexport const BooleanLabellingValue = {\n YES_NO: 'yes/no',\n TRUE_FALSE: 'true/false',\n ON_OFF: 'on/off',\n ENABLED_DISABLED: 'enabled/disabled',\n ACTIVE_INACTIVE: 'active/inactive',\n} as const;\nexport type BooleanLabellingValue = typeof BooleanLabellingValue[keyof typeof BooleanLabellingValue];\n\n/**\n * Display mode for boolean fields\n */\nexport const BooleanDisplayMode = {\n RAW: 'raw',\n CHECKMARK: 'checkmark',\n EDIT_LIKE: 'edit_like',\n} as const;\nexport type BooleanDisplayMode = typeof BooleanDisplayMode[keyof typeof BooleanDisplayMode];\n\n/**\n * Edit mode for boolean fields\n */\nexport const BooleanEditMode = {\n TOGGLE: 'toggle',\n SWITCH: 'switch',\n CHECKBOX: 'checkbox',\n RADIO: 'radio',\n} as const;\nexport type BooleanEditMode = typeof BooleanEditMode[keyof typeof BooleanEditMode];\n\n//------------------------------------------------------------------------------------------------\n// STRING DISPLAY POLICY\n//------------------------------------------------------------------------------------------------\n\n/**\n * String display modes for rendering string values\n */\nexport const StringDisplayMode = {\n TEXT: 'text',\n TRUNCATE: 'truncate',\n MULTILINE: 'multiline',\n /**\n * Render the value as rich markdown (GFM: headings, lists, tables, links,\n * task lists, fenced code). For long-form authored content — descriptions,\n * notes, documentation fields. Headings are demoted for embedded context\n * (a `#` inside a field body never competes with the page title) and every\n * element is styled through the active theme's typography recipes. Pair\n * with `edit.editMode: MARKDOWN` (syntax-tinted source editor) — or plain\n * `TEXTAREA` — the edit side stays markdown SOURCE either way.\n */\n MARKDOWN: 'markdown',\n COLOR: 'color',\n LINK: 'link',\n EMAIL: 'email',\n BADGE: 'badge',\n COPY: 'copy',\n SECRET: 'secret',\n} as const;\nexport type StringDisplayMode = typeof StringDisplayMode[keyof typeof StringDisplayMode];\n\n/**\n * String edit modes for form components\n */\nexport const StringEditMode = {\n INPUT: 'input',\n TEXTAREA: 'textarea',\n COLOR: 'color',\n PASSWORD: 'password',\n OTP: 'otp',\n /**\n * Markdown SOURCE editor (CodeMirror-backed, syntax-tinted, theme-token\n * styled). The stored value stays plain markdown source — display-side\n * rendering remains owned by `StringDisplayMode.MARKDOWN` (Streamdown).\n * This is deliberately NOT a WYSIWYG mode; a rich visual editor is a\n * separate future edit mode/component.\n */\n MARKDOWN: 'markdown',\n} as const;\nexport type StringEditMode = typeof StringEditMode[keyof typeof StringEditMode];\n\n//------------------------------------------------------------------------------------------------\n// NUMBER DISPLAY POLICY\n//------------------------------------------------------------------------------------------------\n\n/**\n * Number display modes for rendering number values\n */\nexport const NumberDisplayMode = {\n RAW: 'raw',\n FORMATTED: 'formatted',\n PERCENTAGE: 'percentage',\n COMPACT: 'compact',\n ORDINAL: 'ordinal',\n BYTES: 'bytes',\n} as const;\nexport type NumberDisplayMode = typeof NumberDisplayMode[keyof typeof NumberDisplayMode];\n\n/**\n * Number edit modes for form components\n */\nexport const NumberEditMode = {\n INPUT: 'input',\n SLIDER: 'slider',\n STEPPER: 'stepper',\n} as const;\nexport type NumberEditMode = typeof NumberEditMode[keyof typeof NumberEditMode];\n\n\n/**\n * Scale modes for percentage display.\n * - NORMALIZED: value is 0–1, Intl.NumberFormat's style:'percent' handles ×100\n * - PERCENT: value is already 0–100, must be divided by 100 before passing to Intl\n */\nexport const PercentageScale = {\n NORMALIZED: 'normalized',\n PERCENT: 'percent',\n} as const;\nexport type PercentageScale = typeof PercentageScale[keyof typeof PercentageScale];\n\n//------------------------------------------------------------------------------------------------\n// BIGDECIMAL DISPLAY / EDIT MODES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Display mode for BigDecimal fields.\n * Subset of NumberDisplayMode — COMPACT/ORDINAL/BYTES excluded for arbitrary precision numbers.\n */\nexport const BigDecimalDisplayMode = {\n RAW: 'raw',\n FORMATTED: 'formatted',\n PERCENTAGE: 'percentage',\n} as const;\nexport type BigDecimalDisplayMode = typeof BigDecimalDisplayMode[keyof typeof BigDecimalDisplayMode];\n\n/**\n * Edit mode for BigDecimal fields.\n * Only INPUT — SLIDER/STEPPER are not applicable for arbitrary precision numbers.\n */\nexport const BigDecimalEditMode = {\n INPUT: 'input',\n} as const;\nexport type BigDecimalEditMode = typeof BigDecimalEditMode[keyof typeof BigDecimalEditMode];\n/** @wildo_source:part:end zod.decorators.display-edit-modes */\n\n//------------------------------------------------------------------------------------------------\n// ENUM DISPLAY POLICY\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.enums.frontend-handling facet:layer:frontend facet:layer:shared facet:family:enum facet:family:ui facet:surface:form facet:surface:display\n *\n * Enum display modes for rendering enum values\n */\nexport const EnumDisplayMode = {\n TEXT: 'text',\n BADGE: 'badge',\n ICON: 'icon',\n CARD: 'card',\n} as const;\nexport type EnumDisplayMode = typeof EnumDisplayMode[keyof typeof EnumDisplayMode];\n\n/**\n * Enum edit modes for form components\n */\nexport const EnumEditMode = {\n SELECT: 'select',\n RADIO: 'radio',\n RADIO_ICON_ONLY: 'radio_icon_only',\n TOGGLE: 'toggle',\n TOGGLE_ICON_ONLY: 'toggle_icon_only',\n CARD: 'card',\n CARD_ICON_ONLY: 'card_icon_only',\n COMBOBOX: 'combobox',\n} as const;\nexport type EnumEditMode = typeof EnumEditMode[keyof typeof EnumEditMode];\n\n/**\n * Layout direction for form layouts\n */\nexport const LayoutDirection = {\n HORIZONTAL: 'horizontal',\n VERTICAL: 'vertical',\n} as const;\nexport type LayoutDirection = typeof LayoutDirection[keyof typeof LayoutDirection];\n\n/**\n * Semantic badge variants for enum display.\n * These map 1:1 to the Badge component's `variant` prop in presets-components.\n */\nexport const BadgeSemanticVariant = {\n DEFAULT: 'default',\n SECONDARY: 'secondary',\n OUTLINE: 'outline',\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n DESTRUCTIVE: 'destructive',\n} as const;\nexport type BadgeSemanticVariant = typeof BadgeSemanticVariant[keyof typeof BadgeSemanticVariant];\n\n/**\n * An icon reference — either a React component (Lucide, custom SVG) or\n * a string key (StandardIconReference) resolved via the icon registry.\n *\n * When `string`: resolved at render time through `renderIcon(key, opts)`.\n * When `ComponentType`: rendered directly via `React.createElement(icon, props)`.\n */\nexport type IconLike = ComponentType<{ size?: number; color?: string; className?: string; strokeWidth?: number }> | string;\n\n/**\n * Per-value display configuration for enum fields.\n * Groups all visual properties for a single enum value in one place.\n */\nexport interface EnumValueDisplayConfig {\n /** Badge variant / color for this enum value */\n color?: BadgeSemanticVariant;\n /** Icon for this enum value — React component or StandardIconReference string */\n icon?: IconLike;\n}\n/** @wildo_source:part:end zod.decorators.enums.frontend-handling */\n\n\n/**\n * Updater function accepted by any decorator with object params.\n *\n * Receives the current metadata value (or `undefined` if no prior decorator\n * or if the prior value is the `true` boolean shorthand). Returns the new value.\n *\n * For mergeable primitive decorators (`{primitive}UI()` and `{primitive}Spec()`),\n * the updater bypasses the normal deep-merge behavior — the returned value\n * replaces entirely.\n *\n * @example\n * ```ts\n * schema.enumUI((current) => ({\n * ...current,\n * defaultColor: 'secondary',\n * values: { ...current?.values, active: { color: 'success' } },\n * }));\n *\n * schema.formComponent((current) => ({\n * ...current,\n * component: 'custom-input',\n * hideLabel: true,\n * }));\n * ```\n */\nexport type DecoratorUpdater<T> = (current: T | undefined) => T;\n\n//------------------------------------------------------------------------------------------------\n// FOREIGN KEY DISPLAY PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.foreign-key-display-mode facet:layer:frontend facet:family:ui facet:surface:display facet:surface:picker\n *\n * Foreign-key reference display vocabulary — how a foreign-key field renders, both\n * as a stored VALUE in read views and as each ROW in the reference picker's\n * dropdown (the picker is shared by forms and collection filters). Authored via\n * `.foreignKeyUI(...)` from `@wildo-ai/zod-decorators` on the FK field:\n * - `display.mode` — how the saved FK value renders in a read view.\n * - `edit.optionDisplayMode` — how each picker dropdown ROW renders while selecting.\n *\n * Modes:\n * - `ID`: the raw FK id string. As a picker row this is treated as `LABEL`.\n * - `LABEL`: a one-line resolved label via `getFrontendResourceLabel`. The default on\n * BOTH surfaces — see {@link DEFAULT_FOREIGN_KEY_DISPLAY_MODE} and\n * {@link DEFAULT_FOREIGN_KEY_OPTION_DISPLAY_MODE}.\n * - `SUMMARY`: the referenced resource's summary view — its summary fields with NO\n * action bar (a compact card). Always an opt-in, on both surfaces.\n *\n * \"summary\" here is about FK RENDERING, not API data shape (`DataMode.SUMMARY`) or\n * operation-bar density (`ResourceOperationDisplayMode.SUMMARY`).\n *\n * @example\n * // Make the picker dropdown rows show the referenced resource's summary card:\n * assigneeUserId: z.string().isForeignKey().foreignKeyUI({\n * edit: { optionDisplayMode: ForeignKeyDisplayMode.SUMMARY },\n * })\n */\nexport const ForeignKeyDisplayMode = {\n ID: 'id',\n LABEL: 'label',\n SUMMARY: 'summary',\n} as const;\n\nexport type ForeignKeyDisplayMode = typeof ForeignKeyDisplayMode[keyof typeof ForeignKeyDisplayMode];\n\n/**\n * The mode an FK's stored VALUE renders in when the field authors no\n * `.foreignKeyUI({ display: { mode } })`.\n *\n * **This is the single source for that default.** Every site that has to supply a\n * fallback display mode derives from this constant rather than restating a member of\n * {@link ForeignKeyDisplayMode}. It exists because the default was previously declared\n * twice and the two declarations DISAGREED — the metadata reader said `LABEL`, the\n * display preset said `SUMMARY` — so the answer an app author got depended on which\n * resolution path happened to run, and the prose above this enum documented the losing\n * one.\n *\n * `LABEL` is the default because it is the cheap, composable rendering: one resolved\n * line that fits a table cell, a detail row and a dense list alike. `SUMMARY` renders a\n * card of the referenced record's summary fields — appropriate when the parent's\n * details matter AT the point of reference, which is a per-field authoring judgement,\n * not something a framework can assume for every FK in an application.\n *\n * @example\n * // Opt a single field into the card rendering:\n * todoListId: z.string().isForeignKey().foreignKeyUI({\n * display: { mode: ForeignKeyDisplayMode.SUMMARY },\n * })\n */\nexport const DEFAULT_FOREIGN_KEY_DISPLAY_MODE: ForeignKeyDisplayMode = ForeignKeyDisplayMode.LABEL;\n\n/**\n * The mode each ROW of the reference picker's dropdown renders in when the field\n * authors no `.foreignKeyUI({ edit: { optionDisplayMode } })`.\n *\n * **This is the single source for that default**, and it is deliberately a SEPARATE\n * constant from {@link DEFAULT_FOREIGN_KEY_DISPLAY_MODE}. The two answer different\n * questions — \"how does a stored reference read?\" versus \"how does a candidate read\n * while I am choosing one?\" — and a framework that collapsed them would make one\n * surface's default un-tunable without moving the other. They currently coincide on\n * `LABEL`; that agreement is a fact about today's values, not a shared identity.\n */\nexport const DEFAULT_FOREIGN_KEY_OPTION_DISPLAY_MODE: ForeignKeyDisplayMode = ForeignKeyDisplayMode.LABEL;\n/** @wildo_source:part:end zod.decorators.foreign-key-display-mode */\n\n/**\n * Polymorphic FK variant definition.\n *\n * Describes one scope-branch of a polymorphic foreign key. A variant has two\n * complementary roles, depending on whether the FK is renamed-per-holder or\n * shared-with-discriminator (see {@link ForeignKeyStructuralParams.polymorphicVariants}):\n *\n * 1. **Rename role** (`parentResourceType` + `parentFieldIdentifier`): when the\n * FK's HOLDER resource is polymorphically expanded into per-scope variants,\n * the factory uses these to rename the FK field per variant — e.g.\n * `billingAccountId` → `organizationBillingAccountId`.\n * 2. **Discriminated-resolution role** (`discriminatorValue`): when the FK is a\n * single SHARED field on a flat holder that points at a polymorphic branch\n * GROUP, this value links the holder record's discriminator field value to\n * THIS branch. See {@link ForeignKeyStructuralParams.polymorphicDiscriminatorField}.\n */\nexport interface PolymorphicFkVariant {\n /** The parent (scope-root) resource type, e.g. `'organizations'` / `'users'`. */\n parentResourceType: string;\n /** The parent's field identifier, e.g. `'organizationId'` / `'userId'`. */\n parentFieldIdentifier: string;\n /**\n * Value of the FK's `polymorphicDiscriminatorField` (read off the SAME record)\n * that selects this variant's branch. Only meaningful for shared-field\n * discriminated FKs; ignored by the per-variant rename path. E.g. a referral's\n * `referrerScopeType === 'organizations'` selects the organizations variant,\n * whose branch is `organizationBillingAccounts`.\n */\n discriminatorValue?: string;\n}\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Structural FK params — backend/factory-relevant subset.\n * Stays on `IS_FOREIGN_KEY`. UI-specific params (mode, linkable,\n * displayPresetOverride) live on `ForeignKeyUIParams` via `.foreignKeyUI()`.\n */\nexport interface ForeignKeyStructuralParams {\n /**\n * Marks this FK as polymorphic over a set of scope branches.\n *\n * - On a resource that is itself polymorphically expanded, these drive the\n * per-variant FK field RENAME (e.g. `billingAccountId` →\n * `organizationBillingAccountId`).\n * - On a FLAT resource that holds ONE shared FK to a polymorphic branch group\n * (e.g. a referral's `referrerBillingAccountId` → user OR organization\n * billing account), combine with {@link polymorphicDiscriminatorField}: each\n * variant carries a `discriminatorValue`, and the concrete branch is\n * resolved PER RECORD from the discriminator field. The single-valued\n * registry FK→type map keeps a non-authoritative representative for these\n * fields; the per-record resolver is authoritative for display/links.\n */\n polymorphicVariants?: PolymorphicFkVariant[];\n /**\n * Sibling field name (on the SAME record) whose value selects which\n * {@link polymorphicVariants} branch this record's FK points at. Required to\n * turn `polymorphicVariants` into a per-record discriminated FK; pairs with\n * each variant's `discriminatorValue`. The value is matched against the\n * candidate branches' primary scope, so it typically holds a scope-type enum\n * (e.g. `referrerScopeType`). Without it, `polymorphicVariants` is rename-only.\n */\n polymorphicDiscriminatorField?: string;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n\n//------------------------------------------------------------------------------------------------\n// RANGE SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Supported types for range schemas.\n */\nexport enum RangeType {\n NUMBER = 'number',\n DATE = 'date',\n DATETIME = 'datetime',\n TIME = 'time',\n BIGDECIMAL = 'bigdecimal',\n MONEY = 'money',\n}\n/**\n * Type mapping for range schema outputs.\n * Maps RangeType to the resulting schema's inferred TypeScript type.\n */\n/**\n * Type mapping for range schema outputs.\n * Maps RangeType to the resulting schema's inferred TypeScript type.\n * Note: Money and BigDecimal have their actual types, but for range purposes,\n * the actual Zod schemas (MoneyValueSchema, BigDecimalValueSchema) define the real structure.\n */\nexport type RangeTypeMapping = {\n [RangeType.NUMBER]: number;\n [RangeType.DATE]: Date;\n [RangeType.DATETIME]: string; // ISO datetime string\n [RangeType.TIME]: string; // ISO time string (HH:MM:SS)\n [RangeType.BIGDECIMAL]: string; // BigDecimal string value (validated by BigDecimalValueSchema)\n [RangeType.MONEY]: { amount: bigint; currency: string; decimals: number }; // MoneyValue object\n};\n\n/**\n * Min/max constraint value types based on range type.\n */\nexport type RangeConstraintValue = number | Date | string;\n\n\nexport interface RangeSchemaMetadata {\n /** Marker for detecting range schemas */\n isRange: true;\n /** The type of values in the range */\n type: RangeType;\n /** Whether the 'from' field is optional (default: true) */\n fromOptional: boolean;\n /** Whether the 'to' field is optional (default: true) */\n toOptional: boolean;\n /** Minimum allowed value (for UI hints and validation) */\n min?: RangeConstraintValue;\n /** Maximum allowed value (for UI hints and validation) */\n max?: RangeConstraintValue;\n}\n\n/**\n * Options for creating a range schema.\n */\nexport interface RangeSchemaOptions {\n /** Whether the 'from' field is optional (default: true) */\n fromOptional?: boolean;\n /** Whether the 'to' field is optional (default: true) */\n toOptional?: boolean;\n /** Minimum allowed value (stored in metadata for UI hints) */\n min?: RangeConstraintValue;\n /** Maximum allowed value (stored in metadata for UI hints) */\n max?: RangeConstraintValue;\n}\n\n// Range type for range schemas (matches RangeType from saas-models).\n// Duplicated here to avoid circular dependency.\nexport enum RangeSchemaType {\n NUMBER = 'number', // Number schemas (z.number, z.int)\n DATE = 'date', // Date schemas (z.date)\n DATETIME = 'datetime', // Datetime schemas (z.datetime)\n TIME = 'time', // Time schemas (z.time)\n BIGDECIMAL = 'bigdecimal', // BigDecimal schemas (z_bigdecimal)\n MONEY = 'money', // Money schemas (z_money)\n}\n\n\n// Map range type to its default component.\nexport const RangeTypeToComponent: Record<RangeSchemaType, FormFieldComponent> = {\n [RangeSchemaType.NUMBER]: FormFieldComponent.RANGE_SLIDER,\n [RangeSchemaType.DATE]: FormFieldComponent.DATE_RANGE,\n [RangeSchemaType.DATETIME]: FormFieldComponent.DATETIME_RANGE,\n [RangeSchemaType.TIME]: FormFieldComponent.TIME_RANGE,\n [RangeSchemaType.BIGDECIMAL]: FormFieldComponent.BIGDECIMAL_RANGE,\n [RangeSchemaType.MONEY]: FormFieldComponent.MONEY_RANGE,\n};\n\n// Get the default form component for a range type.\nexport function getDefaultRangeComponent(rangeType: RangeSchemaType | string): FormFieldComponent {\n return RangeTypeToComponent[rangeType as RangeSchemaType] ?? FormFieldComponent.RANGE_SLIDER;\n}\n\n\n/**\n * Inferred type for a range schema based on options.\n */\nexport type RangeSchemaInferredType<\n T extends RangeType,\n FromOptional extends boolean = true,\n ToOptional extends boolean = true\n> = {\n from: FromOptional extends true ? RangeTypeMapping[T] | undefined : RangeTypeMapping[T];\n to: ToOptional extends true ? RangeTypeMapping[T] | undefined : RangeTypeMapping[T];\n};\n\n//------------------------------------------------------------------------------------------------\n// MONEY SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Metadata stored on money schemas for detection and configuration.\n * Money schemas represent financial amounts with bigint storage to avoid precision issues.\n * Structure: { amount: bigint, currency: string, decimals: number (int) }\n */\nexport interface MoneySchemaMetadata {\n /** Marker for detecting money schemas */\n isMoney: true;\n /**\n * Currency category filter. Replaces old `showCrypto` / `majorOnly` / `fiatOnly` booleans.\n * E.g. `[CurrencyAllowed.FIAT]` = fiat only, `[CurrencyAllowed.FIAT_MAJOR]` = major fiat only.\n * When undefined or empty, all currencies are available.\n */\n currenciesAllowed?: CurrencyAllowed[];\n /** Whether to show only app-enabled currencies (default: true). Renamed from `enabledOnly`. */\n appEnabledOnly?: boolean;\n /** Whether to allow currency change (default: true) */\n allowCurrencyChange?: boolean;\n /** Minimum amount in smallest unit as bigint (e.g., 0n for non-negative) */\n minAmount?: bigint;\n /** Maximum amount in smallest unit as bigint */\n maxAmount?: bigint;\n}\n\n/**\n * Options for creating a money schema.\n */\nexport interface MoneySchemaOptions {\n /**\n * Currency category filter. Replaces old `showCrypto` / `majorOnly` / `fiatOnly` booleans.\n * E.g. `[CurrencyAllowed.FIAT]` = fiat only, `[CurrencyAllowed.FIAT_MAJOR]` = major fiat only.\n * When undefined or empty, all currencies are available.\n */\n currenciesAllowed?: CurrencyAllowed[];\n /** Whether to show only app-enabled currencies (default: true). Renamed from `enabledOnly`. */\n appEnabledOnly?: boolean;\n /** Whether to allow currency change (default: true) */\n allowCurrencyChange?: boolean;\n /** Minimum amount in smallest unit as bigint (e.g., 0n for non-negative) */\n minAmount?: bigint;\n /** Maximum amount in smallest unit as bigint */\n maxAmount?: bigint;\n}\n\n//------------------------------------------------------------------------------------------------\n// BIGDECIMAL SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Metadata stored on bigdecimal schemas for detection and configuration.\n * BigDecimal schemas represent precise decimal numbers stored as strings.\n * Uses big.js for precise arithmetic operations.\n */\nexport interface BigDecimalSchemaMetadata {\n /** Marker for detecting bigdecimal schemas */\n isBigDecimal: true;\n /** Maximum number of decimal places allowed */\n precision?: number;\n /** Minimum value (as string for precision) */\n min?: string;\n /** Maximum value (as string for precision) */\n max?: string;\n}\n\n/**\n * Options for creating a bigdecimal schema.\n */\nexport interface BigDecimalSchemaOptions {\n /** Maximum number of decimal places allowed */\n precision?: number;\n /** Minimum value (as string for precision) */\n min?: string;\n /** Maximum value (as string for precision) */\n max?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// DURATION SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Duration units enum.\n * Uses string values for JSON serialization and API compatibility.\n * Aligns with common patterns (e.g., expiresIn: { value, unit }).\n */\nexport enum DurationUnit {\n MILLISECONDS = 'milliseconds',\n SECONDS = 'seconds',\n MINUTES = 'minutes',\n HOURS = 'hours',\n DAYS = 'days',\n WEEKS = 'weeks',\n MONTHS = 'months',\n YEARS = 'years',\n CENTURIES = 'centuries',\n}\n\n/**\n * Token expiry duration — minutes, hours, or days only.\n * Structurally compatible with DurationValue. Use ExpiresInDurationSchema for validation.\n */\nexport type ExpiresInDuration = {\n value: number;\n unit: DurationUnit.MINUTES | DurationUnit.HOURS | DurationUnit.DAYS;\n};\n\n/**\n * Metadata stored on duration schemas for detection and configuration.\n * Duration schemas represent time spans with { value: number, unit: DurationUnit }.\n */\nexport interface DurationSchemaMetadata {\n /** Marker for detecting duration schemas */\n isDuration: true;\n /** Allowed units (if empty/undefined, all units are allowed) */\n allowedUnits?: DurationUnit[];\n /** Minimum value (for the numeric part) */\n minValue?: number;\n /** Maximum value (for the numeric part) */\n maxValue?: number;\n}\n\n//------------------------------------------------------------------------------------------------\n// PHONE SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * ISO 3166-1 alpha-2 country code (e.g., 'US', 'FR').\n *\n * Narrowed to libphonenumber's `CountryCode` union (not a bare `string`) so an\n * invalid code fails at COMPILE time. The runtime consequence of a bad code is\n * a throw from `getCountryCallingCode` — and since the international phone\n * edit control renders the selected dial code, an invalid authored\n * `defaultCountry` would crash the form at first render, not merely misparse.\n */\nexport type PhoneCountryCode = LibPhoneNumberCountryCode;\n\n/**\n * Metadata stored on phone schemas for detection and configuration.\n * Phone schemas store E.164 strings.\n */\nexport interface PhoneSchemaMetadata {\n /** Marker for detecting phone schemas */\n isPhone: true;\n /** Default country when parsing numbers without country code */\n defaultCountry?: PhoneCountryCode;\n}\n\n/**\n * Options for creating a phone schema via z_phone().\n */\nexport interface PhoneSchemaOptions {\n /** Default country when parsing numbers without country code */\n defaultCountry?: PhoneCountryCode;\n}\n\n//------------------------------------------------------------------------------------------------\n// CODE SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Supported code/programming languages for code schemas.\n */\nexport type CodeLanguage =\n | 'javascript' | 'typescript' | 'python' | 'java' | 'csharp' | 'cpp' | 'c'\n | 'go' | 'rust' | 'ruby' | 'php' | 'swift' | 'kotlin' | 'scala'\n | 'html' | 'css' | 'scss' | 'less' | 'json' | 'yaml' | 'xml' | 'markdown'\n | 'sql' | 'graphql' | 'bash' | 'shell' | 'powershell'\n | 'dockerfile' | 'nginx' | 'apache'\n | 'plaintext' | string;\n\n/**\n * Metadata stored on code schemas for detection and configuration.\n * Code schemas represent code snippets with language information.\n * Structure: { content: string, language: string }\n */\nexport interface CodeSchemaMetadata {\n /** Marker for detecting code schemas */\n isCode: true;\n /** Allowed languages (if empty, all languages are allowed) */\n allowedLanguages?: CodeLanguage[];\n /** Maximum content length in characters */\n maxLength?: number;\n /** Minimum content length in characters */\n minLength?: number;\n}\n\n\n\n/**\n * Options for creating a code schema.\n */\nexport interface CodeSchemaOptions {\n /** Allowed languages (if empty, all languages are allowed) */\n allowedLanguages?: CodeLanguage[];\n /** Maximum content length in characters */\n maxLength?: number;\n /** Minimum content length in characters */\n minLength?: number;\n}\n\n//------------------------------------------------------------------------------------------------\n// FILE SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Common MIME type groups for file uploads.\n */\nexport const FileMimeTypeGroups = {\n /** Image files: JPEG, PNG, GIF, WebP, SVG, etc. */\n Images: [\n 'image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml',\n 'image/bmp', 'image/tiff', 'image/x-icon', 'image/heic', 'image/heif'\n ],\n /** Video files: MP4, WebM, AVI, MOV, etc. */\n Video: [\n 'video/mp4', 'video/webm', 'video/ogg', 'video/avi', 'video/quicktime',\n 'video/x-msvideo', 'video/x-ms-wmv', 'video/mpeg', 'video/3gpp'\n ],\n /** Audio files: MP3, WAV, OGG, etc. */\n Audio: [\n 'audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/webm', 'audio/aac',\n 'audio/flac', 'audio/x-m4a', 'audio/mp4'\n ],\n /** PDF documents */\n PDF: ['application/pdf'],\n /** Office documents: Word, Excel, PowerPoint, etc. */\n Office: [\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/vnd.ms-excel',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/vnd.ms-powerpoint',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'application/vnd.oasis.opendocument.text',\n 'application/vnd.oasis.opendocument.spreadsheet',\n 'application/vnd.oasis.opendocument.presentation'\n ],\n /** All documents: PDF + Office */\n Documents: [\n 'application/pdf',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/vnd.ms-excel',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/vnd.ms-powerpoint',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'application/vnd.oasis.opendocument.text',\n 'application/vnd.oasis.opendocument.spreadsheet',\n 'application/vnd.oasis.opendocument.presentation'\n ],\n /** Archives: ZIP, RAR, 7z, etc. */\n Archives: [\n 'application/zip', 'application/x-zip-compressed',\n 'application/x-rar-compressed', 'application/x-7z-compressed',\n 'application/gzip', 'application/x-tar'\n ],\n} as const;\n\nexport type FileMimeTypeGroup = keyof typeof FileMimeTypeGroups;\n\n/**\n * File nature classification for constraint validation and UI display.\n */\nexport enum FileNature {\n IMAGE = 'image',\n VIDEO = 'video',\n AUDIO = 'audio',\n PDF = 'pdf',\n OFFICE = 'office',\n ARCHIVE = 'archive',\n ALL = 'all',\n}\n\n/**\n * Rendering-level file nature categories.\n *\n * Maps the granular `FileNature` schema enum into coarser display categories\n * used by frontend components to select the appropriate renderer:\n * - `FileNature.PDF` + `FileNature.OFFICE` → `FileDisplayNature.DOCUMENT`\n * - `FileNature.ARCHIVE` + `FileNature.ALL` + unknown → `FileDisplayNature.GENERIC`\n *\n * Use `resolveFileDisplayNature()` from `zod-file.ts` to resolve from\n * schema metadata and/or MIME type.\n */\nexport enum FileDisplayNature {\n IMAGE = 'image',\n VIDEO = 'video',\n AUDIO = 'audio',\n DOCUMENT = 'document',\n GENERIC = 'generic',\n}\n\n/**\n * Frame shape for an inline media (image) preview — see `FileUIDisplayParams.preview`.\n * - `ROUNDED` (default): rounded-corner rectangle, aspect preserved (`object-contain`).\n * - `SQUARE`: sharp-corner rectangle, aspect preserved.\n * - `CIRCLE`: circular frame; the image is cropped to fill (`object-cover`). Typical\n * for avatars / profile pictures.\n */\nexport enum FileMediaShape {\n ROUNDED = 'rounded',\n SQUARE = 'square',\n CIRCLE = 'circle',\n}\n\n/**\n * Rendered size tier for an inline media (image) preview — see\n * `FileUIDisplayParams.preview`. `XS`–`XL` are fixed dimensions (a `CIRCLE` uses the\n * value as its diameter; a rectangle uses it as the max width). `FULL` fills the\n * available column width (the default, container-responsive) — best for cover images,\n * not avatars.\n */\nexport enum FileMediaSize {\n XS = 'xs',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n FULL = 'full',\n}\n\n/**\n * How a file field renders AT REST, before any interaction — one of the two\n * orthogonal axes of the file display policy (the other is\n * {@link FileActivationPolicy}, what a click does).\n *\n * - `CARD` (default): the neutral file card — icon + filename + size. Compact and\n * nature-agnostic, so a detail view holding several documents stays scannable.\n * - `THUMBNAIL`: a small rendered preview of the media beside the title (an image\n * thumbnail, a PDF's rasterised first page). Informative but still compact.\n * - `FULL`: the media rendered inline at full width — an image, a video player, a\n * paginated PDF viewer. The heaviest option: for documents it downloads and mounts\n * the viewer on first paint, so prefer `CARD` + an `OVERLAY` activation unless the\n * document IS the page.\n *\n * `THUMBNAIL` and `FULL` require a displayer for the file's resolved nature; a\n * request the nature cannot satisfy is refused at registry build (narrow declared\n * nature) or degraded to `CARD` at runtime (open nature) — never a broken render.\n */\nexport enum FileDisplayPresentation {\n CARD = 'card',\n THUMBNAIL = 'thumbnail',\n FULL = 'full',\n}\n\n/**\n * What activating (clicking / Enter) a displayed file does — the second axis of the\n * file display policy. Applies to EVERY file nature, not just images.\n *\n * - `NONE`: inert. No cursor affordance, no handler, not focusable as a control.\n * - `OVERLAY`: open the nature's displayer in an overlay (the generalisation of the\n * old image-only lightbox). Requires a displayer for the resolved nature.\n * - `DOWNLOAD`: fetch the bytes over the authenticated serve route and save them.\n * - `NEW_TAB`: open the authenticated serve URL in a new tab (the browser's own\n * viewer, with its native print/save affordances).\n * - `CUSTOM`: run an operation declared on the resource that OWNS this file field —\n * see {@link FileActivationConfig}.\n */\nexport enum FileActivationPolicy {\n NONE = 'none',\n OVERLAY = 'overlay',\n DOWNLOAD = 'download',\n NEW_TAB = 'new_tab',\n CUSTOM = 'custom',\n}\n\n/**\n * The authored activation, discriminated on `policy`.\n *\n * `CUSTOM` names an operation **by identifier**, never a callback. The reference is\n * resolved against the resource that owns the file field, so the click inherits that\n * operation's entire contract for free — `roles` authorization, `enabledCondition`,\n * i18n label/tooltip, icon, risk level and audit emission — none of which a raw\n * handler could carry. It also keeps display config serializable, which the\n * specification layer, the companion and i18n generation all depend on.\n *\n * Dispatch follows the referenced operation's own frontend surface: `ADDRESSABLE`\n * navigates, `EMBEDDED` opens in the overlay host, `API_ONLY` executes directly\n * (with the standard confirmation for critical operations). The clicked file travels\n * to the operation as context (`{ fieldName, fileId }`); the operation targets the\n * owning row. An unresolvable reference fails at registry build, never as a dead control.\n *\n * @example\n * // Click the attachment card to run the owning resource's `send_to_dms` operation.\n * { policy: FileActivationPolicy.CUSTOM, operationIdentifier: 'send_to_dms' }\n */\nexport type FileActivationConfig =\n | {\n policy:\n | FileActivationPolicy.NONE\n | FileActivationPolicy.OVERLAY\n | FileActivationPolicy.DOWNLOAD\n | FileActivationPolicy.NEW_TAB;\n }\n | {\n policy: FileActivationPolicy.CUSTOM;\n /** Operation identifier declared on the resource owning this file field. */\n operationIdentifier: string;\n /** Disambiguates when the operation has several keyed variants. */\n variantKey?: string;\n };\n\n/**\n * Presentation detail for a rendered media preview. Applies when\n * {@link FileUIDisplayParams.presentation} is `THUMBNAIL` or `FULL`; ignored by `CARD`.\n * All fields are optional with sensible defaults (rounded rectangle, full width,\n * caption on). An avatar typically sets `{ shape: CIRCLE, size: MD, showCaption: false }`.\n *\n * Click behaviour is NOT here — it is the separate `activation` axis, so that every\n * nature (not only images) can express it.\n */\nexport interface FileMediaPreviewOptions {\n /** Frame shape. @default FileMediaShape.ROUNDED */\n shape?: FileMediaShape;\n /** Rendered size tier. @default FileMediaSize.FULL */\n size?: FileMediaSize;\n /** Show the caption row (filename / size / dimensions / download) under the media. @default true */\n showCaption?: boolean;\n}\n\n/**\n * Storage providers accepted for file uploads.\n */\nexport enum FileStorageAccepted {\n WILDO_MANAGED = 'wildo_managed',\n LOCAL_DIRECTORY = 'local_directory',\n ONEDRIVE = 'onedrive',\n GOOGLE_DRIVE = 'google_drive',\n DROPBOX = 'dropbox',\n}\n\n/**\n * Context object passed to `FilePathBinding` resolver functions.\n *\n * `relatedObject` may be undefined for standalone uploads (no parent resource).\n * `fileMetadata` and `applicationId` are always provided by the runtime.\n */\nexport interface FilePathBindingContext {\n /** The parent resource instance (undefined for standalone uploads) */\n relatedObject?: Record<string, unknown>;\n /** The z_file() field's schema metadata */\n fileMetadata: FileSchemaMetadata;\n /** Application identifier from the execution context */\n applicationId: string;\n}\n\n/**\n * Policy for `z_file({ multiple: true })` fields.\n *\n * Controls the intermediary subfolder name and individual file naming\n * when several files live under the same instance folder.\n */\nexport interface FileMultipleFilePolicy {\n /**\n * Subfolder name under the resolved folder path.\n * Defaults to the field name when omitted.\n * @example 'personnas'\n */\n subfolder?: string;\n\n /**\n * Determines the individual file name for each upload.\n *\n * - `string` — template with placeholders:\n * `{field}`, `{ts}`, `{uuid}`, `{ext}`, `{original}`\n * - `function` — full control, receives context + file-level info\n *\n * @default '{field}_{ts}_{uuid}.{ext}'\n */\n fileNameTemplate?: string | ((\n context: FilePathBindingContext,\n fileInfo: { fileId: string; fieldName: string; originalFileName?: string },\n ) => string);\n}\n\n/**\n * File path binding configuration authored on `z_file()`.\n *\n * Declares how files for a given field are located in path-based\n * storage backends. The binding is backend-agnostic: it affects the\n * S3 key prefix for managed storage and the filesystem path for\n * local-directory storage alike.\n *\n * ## Path composition\n *\n * ```\n * <provider root>/\n * [applicationId/] ← only if includeApplicationId is true\n * [folderPath(ctx)/] ← dynamic folder path\n * <fileName(ctx) | fileId> ← explicit name or UUID fallback\n * ```\n *\n * When nothing is configured, the fallback is the legacy `{fileId}` key\n * for full backward compatibility.\n *\n * @example\n * ```typescript\n * z_file({\n * filePathBinding: {\n * folderPath: (ctx) => `specs/icps/${ctx.relatedObject?.name}`,\n * fileName: 'personna.md',\n * },\n * })\n * ```\n *\n * @example\n * ```typescript\n * z_file({\n * multiple: true,\n * filePathBinding: {\n * folderPath: (ctx) => `specs/icps/${ctx.relatedObject?.name}`,\n * multipleFilePolicy: {\n * subfolder: 'personnas',\n * fileNameTemplate: '{field}_{ts}_{uuid}.{ext}',\n * },\n * },\n * })\n * ```\n */\nexport interface FilePathBinding {\n /**\n * Determines the folder path relative to the provider's root.\n *\n * - `string` — static path, forward-slash separated.\n * - `function` — receives the binding context and returns the path.\n * The function has access to the related resource object, file metadata,\n * and the applicationId.\n *\n * Forward-slash separated, no leading or trailing slash.\n * @example 'specs/icps'\n * @example (ctx) => `specs/icps/${slugify(ctx.relatedObject?.name)}`\n */\n folderPath?: string | ((context: FilePathBindingContext) => string);\n\n /**\n * File name for single `z_file()` fields (non-multiple).\n * When omitted, falls back to the fileId (UUID-based, legacy behavior).\n *\n * - `string` — static name; can include `{ext}` placeholder.\n * - `function` — receives binding context and returns the file name.\n *\n * @example 'personna.md'\n * @example 'avatar.{ext}'\n * @example (ctx) => `${ctx.relatedObject?.slug}.md`\n */\n fileName?: string | ((context: FilePathBindingContext) => string);\n\n /**\n * Naming policy for `z_file({ multiple: true })` fields.\n * Controls the intermediary subfolder and individual file naming.\n */\n multipleFilePolicy?: FileMultipleFilePolicy;\n\n /**\n * Whether to include the applicationId as a path segment.\n *\n * Each provider has its own default:\n * - `wildo_managed` (S3) → `true` (always, for bucket isolation)\n * - `local_directory` → `false` (volume is typically per-app)\n *\n * Set explicitly to override the provider default.\n */\n includeApplicationId?: boolean;\n}\n\nexport enum FileUploaderEntityType {\n USER = 'user',\n ANONYMOUS_USER = 'anonymous_user',\n // Machine (non-human) uploaders. The value is the PRINCIPAL kind (org/app machine), NOT the\n // credential kind — an api-key AND an OAuth client both authenticate the same machine principal,\n // and the specific credential (api-key vs OAuth client) + its id are recorded on\n // `initiatorIds.machineCredential` (authMethod + credentialId). Keeping this enum principal-keyed\n // (matching USER / ANONYMOUS_USER) avoids mislabelling an OAuth-client upload as an \"api key\".\n ORGANIZATION_MACHINE = 'organization_machine',\n APPLICATION_MACHINE = 'application_machine',\n}\n\nexport type FileUploaderOwnership =\n | {\n uploadedBy: string;\n uploadedByEntityType: FileUploaderEntityType;\n }\n | {\n uploadedBy?: undefined;\n uploadedByEntityType?: undefined;\n };\n\n/**\n * Image format options for file validation.\n */\nexport const ImageFormat = {\n JPEG: 'jpeg',\n PNG: 'png',\n GIF: 'gif',\n WEBP: 'webp',\n SVG: 'svg',\n} as const;\nexport type ImageFormat = typeof ImageFormat[keyof typeof ImageFormat];\n\n/**\n * Video format options for file validation.\n */\nexport const VideoFormat = {\n MP4: 'mp4',\n WEBM: 'webm',\n MOV: 'mov',\n} as const;\nexport type VideoFormat = typeof VideoFormat[keyof typeof VideoFormat];\n\n/**\n * Audio format options for file validation.\n */\nexport const AudioFormat = {\n MP3: 'mp3',\n WAV: 'wav',\n OGG: 'ogg',\n AAC: 'aac',\n} as const;\nexport type AudioFormat = typeof AudioFormat[keyof typeof AudioFormat];\n\n/**\n * Image-specific constraints for file validation.\n */\nexport interface FileNatureConstraints_Image {\n minWidth?: number;\n maxWidth?: number;\n minHeight?: number;\n maxHeight?: number;\n aspectRatio?: { width: number; height: number };\n allowedFormats?: ImageFormat[];\n generateThumbnails?: boolean | { sizes: { width: number; height: number }[] };\n}\n\n/**\n * Video-specific constraints for file validation.\n */\nexport interface FileNatureConstraints_Video {\n maxDuration?: number; // seconds\n minDuration?: number;\n allowedFormats?: VideoFormat[];\n generateThumbnail?: boolean;\n}\n\n/**\n * Audio-specific constraints for file validation.\n */\nexport interface FileNatureConstraints_Audio {\n maxDuration?: number;\n minDuration?: number;\n allowedFormats?: AudioFormat[];\n}\n\n/**\n * Document-specific constraints for file validation.\n */\nexport interface FileNatureConstraints_Document {\n maxPages?: number;\n minPages?: number;\n}\n\n/**\n * @wildo_source:part:start zod.decorators.rag-source facet:layer:shared facet:family:decorator facet:family:param-surface facet:kind:api facet:audience:app-developer\n *\n * How a RAG-source field's text is split into retrieval chunks.\n *\n * Import from `@wildo-ai/zod-decorators`. Every member is a chunking STRATEGY — pick the one that\n * matches the field's real content shape, because chunk boundaries decide what a retrieval hit can\n * quote: a heading-aware split over markdown returns a coherent section, while a fixed-size split\n * over the same text returns whatever fell inside the window.\n *\n * **This is the single named home for the chunking vocabulary** (semantic-string-literals rule).\n * It lives in `zod-decorators` — not `saas-models` — because the dependency arrow points the other\n * way: `saas-models` depends on this package, while the `.ragSource()` decorator params below could\n * never import a `saas-models` enum. Chunking is authored ON THE FIELD, through `.ragSource()`;\n * there is no separate agent-level chunking configuration to keep in step with it.\n *\n * - `FIXED_SIZE` — split every `chunkSize` characters/tokens regardless of structure.\n * - `RECURSIVE` — split on a separator hierarchy (paragraph → sentence → word) down to `chunkSize`.\n * - `SEMANTIC` — split at embedding-detected topic boundaries.\n * - `MARKDOWN` — split on markdown structure (headings, lists, code fences).\n * - `CODE` — split on source-code structure (functions, classes, blocks). Unified in (2026-08-26)\n * from a second copy of this vocabulary that `saas-models` then carried: the member sets differed\n * only by this entry, and shrinking the vocabulary to fit the field decorator would have silently\n * invalidated configurations authored against the wider one — so the union won. That second copy,\n * and the agent-level RAG configuration schemas around it, were retired on 2026-08-27 as a\n * pre-capability design the shipped capability superseded; this object is now the only home.\n */\nexport const RAGChunkingStrategy = {\n FIXED_SIZE: 'fixed_size',\n RECURSIVE: 'recursive',\n SEMANTIC: 'semantic',\n MARKDOWN: 'markdown',\n CODE: 'code',\n} as const;\nexport type RAGChunkingStrategy = typeof RAGChunkingStrategy[keyof typeof RAGChunkingStrategy];\n\n/**\n * Stored metadata for the RAG-source declaration (`.ragSource()` / `addRagSource()` /\n * `z_file({ ragSource })`).\n *\n * Every knob is optional — `z.string().ragSource()` is a complete declaration that accepts the\n * framework chunking defaults — and there is deliberately NO `enabled` flag: a field either carries\n * the decorator (it IS a retrieval-corpus source) or it does not. A boolean that could say\n * \"decorated but disabled\" would make every downstream reader (detection, chunk store, erasure\n * seams) re-ask a question the decorator's presence already answers.\n *\n * Validated at decoration time by the `applySingleDecorator` chokepoint (shared by the fluent\n * method and the escape hatch): `chunkingStrategy` must be a {@link RAGChunkingStrategy} member,\n * `chunkSize` a positive integer, `chunkOverlap` a non-negative integer strictly smaller than\n * `chunkSize` when both are present. Read the stored config back with `getRagSourceConfig(schema)`.\n *\n * Note the split of concerns with file fields: this object configures CHUNKING — how text becomes\n * retrieval chunks — and is identical for a plain string field and a file field. How the TEXT is\n * OBTAINED in the first place is the text provider's concern: trivial for a string field (the value\n * is the text), file-side config for a file field (`FileSchemaOptions.textExtraction`, e.g. OCR).\n */\nexport interface RagSourceConfiguration {\n /** Chunking strategy for this field's text. Omitted = the framework default strategy. */\n chunkingStrategy?: RAGChunkingStrategy;\n /** Target chunk size. Positive integer; omitted = the strategy's default size. */\n chunkSize?: number;\n /** Overlap carried between consecutive chunks. Non-negative integer, `< chunkSize` when both are set. */\n chunkOverlap?: number;\n}\n/** @wildo_source:part:end zod.decorators.rag-source */\n\n/**\n * @wildo_source:part:start zod.decorators.file-generation facet:layer:schema facet:family:pdf-templates\n *\n * Generation sources supported by `z_file()`.\n *\n * Keep this enum in `zod-decorators` instead of `saas-models` so shared schemas\n * can mark generated files without creating a dependency cycle back into the\n * resource/model packages that already consume decorators.\n */\nexport enum FileGenerationSource {\n PDF_TEMPLATE = 'pdfTemplate',\n}\n\n/**\n * Frontend-safe file generation metadata.\n *\n * This is deliberately a stable identifier only. The backend binds that\n * identifier to an imported `PdfTemplateDefinition` during application startup,\n * which keeps live functions and React components out of shared schema metadata.\n */\nexport interface FileGenerationConfig {\n /** The generation system responsible for materializing the file value. */\n source: FileGenerationSource.PDF_TEMPLATE;\n /** Stable id of the backend-bound PDF template definition. */\n templateId: string;\n}\n/** @wildo_source:part:end zod.decorators.file-generation */\n\n/**\n * File metadata returned by the getMetadata endpoint.\n * This describes the uploaded file's properties.\n */\nexport type FileMetadata = {\n /** Unique file identifier */\n fileId: string;\n /** Original filename */\n filename: string;\n /** File size in bytes */\n size: number;\n /** MIME type */\n mimeType: string;\n /** File extension (without dot) */\n extension?: string;\n /** File checksum/hash for integrity */\n checksum?: string;\n /** URL to access/download the file */\n url?: string;\n /** URL to thumbnail (for images/videos) */\n thumbnailUrl?: string;\n /** Display nature category (image, video, audio, document, generic) */\n nature?: FileDisplayNature;\n /** Image width in pixels (for images) */\n width?: number;\n /** Image height in pixels (for images) */\n height?: number;\n /** Duration in seconds (for video/audio) */\n duration?: number;\n /** Page count (for documents) */\n pageCount?: number;\n /** Upload timestamp */\n uploadedAt: Date;\n} & FileUploaderOwnership;\n\n/**\n * File behavior when parent resource is deleted.\n * - CASCADE: Mark the file deleted as part of parent removal; physical storage cleanup is deferred to the cleanup batch\n * - SOFT_DELETE: Same current runtime behavior as CASCADE, but keeps an explicit semantic marker for consumers that want to model softer intent\n * - ORPHAN: Keep file, remove association with parent\n */\nexport const FileOnParentDelete = {\n CASCADE: 'cascade',\n SOFT_DELETE: 'soft-delete',\n ORPHAN: 'orphan',\n} as const;\nexport type FileOnParentDelete = typeof FileOnParentDelete[keyof typeof FileOnParentDelete];\n\n/**\n * @wildo_source:part:start zod.decorators.file-schema\n *\n * Metadata stored on file schemas for detection and configuration.\n * File schemas represent file references with upload capabilities.\n * Structure (single): { fileId: string, updatedAt: Date }\n * Structure (multiple): { fileIds: string[], updatedAt: Date }\n */\nexport interface FileSchemaMetadata {\n /** Marker for detecting file schemas */\n isFile: true;\n /** Whether existing files can be replaced/overridden (default: true) */\n overridable?: boolean;\n /** Allowed MIME types (if empty, all types are allowed) */\n allowedMimeTypes?: string[];\n /** Maximum file size in bytes */\n maxSize?: number;\n /** Minimum file size in bytes */\n minSize?: number;\n /** Whether multiple files can be uploaded (default: false) */\n multiple?: boolean;\n /** Maximum number of files (when multiple is true) */\n maxFiles?: number;\n /** File nature classification */\n nature?: FileNature;\n /** Storage providers accepted for file uploads */\n storageAccepted?: FileStorageAccepted[];\n /** File path binding for structured storage organization */\n filePathBinding?: FilePathBinding;\n /**\n * Generation metadata for files materialized by framework operations instead\n * of user uploads. Generated file fields are readable but omitted from write\n * DTOs by downstream resource tooling.\n */\n generation?: FileGenerationConfig;\n /** Image-specific constraints */\n imageConstraints?: FileNatureConstraints_Image;\n /** Video-specific constraints */\n videoConstraints?: FileNatureConstraints_Video;\n /** Audio-specific constraints */\n audioConstraints?: FileNatureConstraints_Audio;\n /** Document-specific constraints */\n documentConstraints?: FileNatureConstraints_Document;\n /**\n * Text-provider configuration for this file field — HOW text is obtained from the file's bytes\n * when something needs it (today: RAG chunking of a `ragSource` file field; the standalone\n * text-extraction operation reads it too).\n *\n * Deliberately file-side and separate from {@link RagSourceConfiguration}: extraction is a\n * property of the FILE FIELD (its bytes need decoding — PDF parsing, OCR), while chunking is the\n * shared RAG-source concern a plain string field carries identically. The former `extractText`\n * boolean is gone with `z_file({ rag })`: for a `ragSource` file field extraction is implied\n * (a corpus source whose text is never extracted would be a silent no-op), so the only honest\n * remaining knobs are the ones that change HOW extraction runs.\n */\n textExtraction?: FileTextExtractionOptions;\n /**\n * Antivirus scan policy for this file field.\n * - 'required': always scan after upload, regardless of global config\n * - 'skip': never scan this field, even if global scanning is enabled\n * - undefined: inherit from `appConfig.files.scanning.enabled`\n */\n scanPolicy?: 'required' | 'skip';\n /** Behavior when parent resource is deleted (default: CASCADE) */\n onParentDelete?: FileOnParentDelete;\n /**\n * Whether this file field supports public sharing via consumable tokens.\n * When true, the `POST /files/:fileId/share` endpoint will generate a\n * `FILE_PUBLIC_ACCESS` consumable token for this file.\n * @default false\n */\n sharable?: boolean;\n /**\n * Default sharing configuration when `sharable` is true.\n * Controls token duration and max uses for shared links.\n */\n sharableDefaults?: {\n /** Default expiration for share tokens */\n expiresIn?: ExpiresInDuration;\n /** Default max uses for share tokens (BOUNDED_REUSE) */\n maxUses?: number;\n /** Default consumption mode. Defaults to BOUNDED_REUSE if not specified. */\n consumptionMode?: 'SINGLE_USE' | 'BOUNDED_REUSE';\n };\n}\n/** @wildo_source:part:end zod.decorators.file-schema */\n\n/**\n * @wildo_source:part:start zod.decorators.file-rag-source facet:layer:shared facet:family:decorator facet:family:file facet:kind:api facet:audience:app-developer\n *\n * File-side text-extraction knobs (see {@link FileSchemaMetadata.textExtraction} for why these are\n * NOT part of {@link RagSourceConfiguration}).\n *\n * Import from `@wildo-ai/zod-decorators` and pass under `z_file({ textExtraction })`. Extraction\n * answers \"how are this file's BYTES turned into text\"; chunking (`RagSourceConfiguration`) answers\n * \"how is that text split\", and is identical for a file field and a plain string field.\n */\nexport interface FileTextExtractionOptions {\n /**\n * Opt into OCR for image-backed content (scanned documents, photos of text). Off by default:\n * OCR is an external, per-page cost, and most corpus files (PDF with a text layer, plain text,\n * markdown) never need it.\n * @default false\n */\n ocr?: boolean;\n}\n/** @wildo_source:part:end zod.decorators.file-rag-source */\n\n/**\n * Options for creating a file schema.\n */\nexport interface FileSchemaOptions {\n /** Whether existing files can be replaced/overridden (default: true) */\n overridable?: boolean;\n /** Allowed MIME types - can be array of MIME types or group names */\n allowedMimeTypes?: string[] | FileMimeTypeGroup | FileMimeTypeGroup[];\n /** Maximum file size in bytes */\n maxSize?: number;\n /** Minimum file size in bytes */\n minSize?: number;\n /** Whether multiple files can be uploaded (default: false) */\n multiple?: boolean;\n /** Maximum number of files (when multiple is true) */\n maxFiles?: number;\n /** File nature classification */\n nature?: FileNature;\n /** Storage providers accepted for file uploads */\n storageAccepted?: FileStorageAccepted[];\n /** File path binding for structured storage organization */\n filePathBinding?: FilePathBinding;\n /**\n * Marks this file as generated by a framework operation.\n *\n * `FileGenerationSource.PDF_TEMPLATE` is v1's only source and is always\n * single-file PDF output; callers must not combine it with upload-style MIME\n * broadening or multiple-file semantics.\n */\n generation?: FileGenerationConfig;\n /** Image-specific constraints */\n imageConstraints?: FileNatureConstraints_Image;\n /** Video-specific constraints */\n videoConstraints?: FileNatureConstraints_Video;\n /** Audio-specific constraints */\n audioConstraints?: FileNatureConstraints_Audio;\n /** Document-specific constraints */\n documentConstraints?: FileNatureConstraints_Document;\n /**\n * @wildo_source:part:start zod.decorators.file-rag-source facet:layer:shared facet:family:decorator facet:family:file facet:kind:api facet:audience:app-developer\n *\n * Declare this file field a RAG retrieval-corpus source.\n *\n * (The two `z_file()` options below are declared on `FileSchemaOptions` — the object literal\n * `z_file()` accepts.)\n *\n * `z_file({ ragSource: {} })` registers the shared {@link ZodDecorator.RAG_SOURCE} decorator on\n * the schema it returns — the SAME decorator `z.string().ragSource()` uses — so detection and\n * every downstream seam (chunk store, erasure, re-index) see one uniform declaration. The config\n * is stored ONLY on the decorator (read it with `getRagSourceConfig`), never duplicated into\n * {@link FileSchemaMetadata}; how the file's TEXT is obtained is the sibling\n * {@link FileSchemaOptions.textExtraction} knob.\n *\n * Refused with `generation` (a PDF-template output is framework-rendered presentation, not an\n * authored corpus), and subject to the decorator chokepoint's own refusals (secrets, `.ttl()`).\n */\n ragSource?: RagSourceConfiguration;\n /**\n * Text-provider configuration for this file field (OCR opt-in). See\n * {@link FileSchemaMetadata.textExtraction} for the extraction-vs-chunking split.\n */\n textExtraction?: FileTextExtractionOptions;\n /** @wildo_source:part:end zod.decorators.file-rag-source */\n /**\n * Antivirus scan policy for this file field.\n * - 'required': always scan after upload, regardless of global config\n * - 'skip': never scan this field, even if global scanning is enabled\n * - undefined: inherit from `appConfig.files.scanning.enabled`\n */\n scanPolicy?: 'required' | 'skip';\n /** Behavior when parent resource is deleted (default: CASCADE) */\n onParentDelete?: FileOnParentDelete;\n /**\n * Whether this file field supports public sharing via consumable tokens.\n * When true, the `POST /files/:fileId/share` endpoint will generate a\n * `FILE_PUBLIC_ACCESS` consumable token for this file.\n * @default false\n */\n sharable?: boolean;\n /**\n * Default sharing configuration when `sharable` is true.\n * Controls token duration and max uses for shared links.\n */\n sharableDefaults?: {\n /** Default expiration for share tokens */\n expiresIn?: ExpiresInDuration;\n /** Default max uses for share tokens (BOUNDED_REUSE) */\n maxUses?: number;\n /** Default consumption mode. Defaults to BOUNDED_REUSE if not specified. */\n consumptionMode?: 'SINGLE_USE' | 'BOUNDED_REUSE';\n };\n}\n\n/**\n * File field endpoint URLs for file operations.\n * These are passed to the form field component.\n */\nexport interface FileFieldEndpoints {\n /** URL to get file metadata */\n getMetadata: string;\n /** URL to upload a new file. Omitted when the field is intentionally read-only or fail-closed. */\n upload?: string;\n /** URL to override/replace an existing file (optional, uses upload if not provided) */\n override?: string;\n /** URL to delete a file (optional) */\n delete?: string;\n /**\n * Base URL of the resource-integrated file **serve** route for this field, with\n * parent/resource ids already substituted:\n * `{apiBase}/api/v1/…/{resourceId}/files/{fieldSegment}`. The display consumer\n * appends `/{fileId}` and fetches the bytes over the AUTHENTICATED client\n * (authorization inherits the parent resource's READ). Omitted when no resource\n * context is available (fail-closed to the neutral file card). This is distinct\n * from the global `/files/:fileId` download/share surface.\n */\n serve?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// VERSIONED SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Metadata stored on versioned schemas for detection and configuration.\n * Versioned schemas automatically track version history.\n */\nexport interface VersionedSchemaMetadata {\n /** Marker for detecting versioned schemas */\n isVersioned: true;\n /** Initial version number for new records (default: 1) */\n initialVersion?: number;\n}\n\n/**\n * Metadata stored on versioned foreign key schemas for detection and configuration.\n * Versioned foreign keys reference versioned resources.\n */\nexport interface VersionedForeignKeySchemaMetadata {\n /** Marker for detecting versioned foreign key schemas */\n isVersionedForeignKey: true;\n /** The name of the target resource this foreign key references */\n targetResource?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// OTHERS METADATA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.structural-lifecycle-params facet:layer:shared facet:layer:backend facet:family:decorator facet:family:lifecycle\n *\n * Structural and lifecycle decorator parameter types for shared resource\n * schemas.\n *\n * These shapes belong to the shared schema layer:\n * `shared-lib/src/modules/<module>/resources/<resource>/<resource>.schemas.ts`.\n *\n * They describe field behavior that affects persistence, DTO derivation,\n * security boundaries, discriminated variants, validation lifecycle, and other\n * cross-layer mechanics. They are appropriate in the shared Zod schema because\n * backend and frontend consumers both depend on the resulting metadata.\n *\n * Do NOT place per-field UI rendering configuration here. UI decorators such as\n * `.stringUI()` / `.enumUI()` belong in frontend `*.ui-behavior.tsx` files.\n * Do NOT place business-semantics prose here. `{primitive}Spec()` decorators\n * belong in specification overlays.\n *\n * When framework knowledge is generated, this anchored block is intended to be\n * inserted as the deterministic source-of-truth reference for structural\n * decorator parameters instead of maintaining parallel markdown tables.\n */\n// Parameters for the IS_HIDDEN decorator. Controls field visibility based on context.\nexport interface HiddenFieldParams {\n display?: boolean; // Hide in display/read mode\n edit?: boolean; // Hide in edit/form mode\n operations?: string[]; // Hide for specific operations (e.g., 'create', 'update')\n}\n\n// Parameters for the IS_NOT_EDITABLE decorator. Controls when a field is read-only in forms.\nexport interface NotEditableFieldParams {\n operations?: string[]; // Make not editable only for specific operations (e.g., 'update'). If not provided, applies to all operations.\n}\n\n// HiddenFieldParams, NotEditableFieldParams\n// are imported from @wildo-ai/presets-components-models\n\n/**\n * Inline edit mode options\n */\nexport const InlineEditMode = {\n DIRECT: 'direct',\n BUTTON: 'button',\n} as const;\nexport type InlineEditMode = typeof InlineEditMode[keyof typeof InlineEditMode];\n\n/**\n * P10: When to trigger save in inline editing mode\n */\nexport const InlineEditSaveOn = {\n /** Save on blur (when user clicks away) */\n BLUR: 'blur',\n /** Save only on explicit button click */\n EXPLICIT: 'explicit',\n} as const;\nexport type InlineEditSaveOn = typeof InlineEditSaveOn[keyof typeof InlineEditSaveOn];\n\n//------------------------------------------------------------------------------------------------\n// BACKEND-ONLY FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Parameters for the isBackendOnly decorator.\n * Marks fields that should only exist on the backend and be stripped from API responses.\n */\nexport interface BackendOnlyFieldParams {\n /**\n * If true, the field will be included in the response for CREATE operations only,\n * then stripped from all subsequent READ operations.\n * Useful for secrets, API keys, etc. that should only be returned once.\n *\n * This is also the framework's ONLY disclosure-audit trigger: a field that carries it emits one\n * `FIELD_ACCESS` audit event at the moment it is first (and last) exposed. That pairing is not a\n * coincidence — first exposure is the only point at which a backend-only field crosses the client\n * boundary at all, so it is the only point at which \"this value left the system\" is a true claim.\n *\n * Scope limit worth knowing before relying on it: the audit event is raised from the TOP-LEVEL\n * shape of the response DTO. A single `CREATE` is the reliably covered case; do not assume a\n * bulk-create response gives you the same guarantee without checking.\n *\n * assurance-control: WILDO.SECRETS.DISCLOSURE_AUDIT — first disclosure of server-minted secret\n * material is attributable.\n */\n isReturnedAtCreation?: boolean;\n}\n\n/**\n * Parameters for the isWriteOnlySecret decorator.\n * Marks a user-provided secret that stays in CREATE/UPDATE request DTOs\n * (client-writable) but is masked to a placeholder on every client-facing\n * response DTO; the real value is retained for backend internal reads.\n * Read-side masking and the write-back sentinel are enforced by the framework\n * at the client-serialization boundary — no per-resource custom implementation\n * needed.\n *\n * Pick the right secret posture by **who owns the value and which direction it\n * flows** — the three are mutually exclusive on a field:\n * - `.isWriteOnlySecret()` — the CLIENT supplies the secret and the server keeps\n * it (e.g. a webhook signing key, an SSO client secret). Client-writable,\n * masked on read, real value kept for backend use. Re-submitting the mask is\n * a no-op (the stored value is preserved).\n * - `.isEphemeral()` — the SERVER mints the secret and hands it to the client\n * exactly once at creation (e.g. an API key shown in a one-time reveal). Not\n * client-writable, not re-readable afterwards. A composite decorator (secret\n * display + one-time reveal + not-editable).\n * - `.isBackendOnly()` — the field never crosses the client boundary in EITHER\n * direction. Do NOT use it for a client-provided secret: it strips the field\n * from the write DTOs too, so the client could never set the value.\n */\nexport interface WriteOnlySecretFieldParams {\n /**\n * Intentionally empty.\n *\n * A write-only secret is masked on EVERY client-facing response, so there is no disclosure to\n * audit — the real value never crosses the boundary. The parameter bag is kept so the decorator\n * can gain options later without changing its call shape.\n */\n readonly _reserved?: never;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// IMPERSONALIZATION SCRUB PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * Stored metadata for the impersonalization scrub treatment (`.impersonalizeWith()` /\n * `addImpersonalizeWith()`).\n *\n * This metadata deliberately stays outside the `shared-structural-params` subsection, mirroring\n * the decorator method itself. Impersonalization has distinct lifecycle and retention semantics,\n * so it needs dedicated application-facing guidance when the installed runtime exposes it.\n */\nexport interface ImpersonalizeFieldParams {\n /**\n * The scrub treatment — a `RedactionType` value carried as an opaque string (zod-decorators sits\n * below saas-models and cannot reference the enum type). REQUIRED and non-empty: a field either\n * declares how it is scrubbed, or carries no treatment at all.\n */\n treatment: string;\n /**\n * `MASK` only — the literal value written in place of this field, overriding the framework's\n * default mask constant.\n *\n * **Why this exists.** The default mask is an UNCONSTRAINED string, so it cannot be written into\n * exactly the fields most likely to need masking: a CONSTRAINED string — `z.email()`, `z.uuid()`,\n * `.min(n)` — rejects it and the boot guard fails the config. Without an override, such a field\n * can only be erased by widening it to `.nullish()` for a `REMOVE` scrub. For a unique identity\n * anchor (`User.email` is the motivating case) that trades a permanently weaker type on every\n * consumer for a state only the audited see-through reader can ever observe, since a retained row\n * is hidden from every normal read. The override keeps the authored type intact.\n *\n * **Contract.** The value must satisfy the field's OWN schema — the boot guard `safeParse`s it\n * against that schema and fails loud otherwise. It is STATIC: the same value is written to every\n * row of a scrub batch (the scrub is one `$set`), so choose something meaningless as data and\n * safe to collide on. For an email, an RFC 2606 reserved `.invalid` address is the honest choice —\n * that TLD can never be registered or delivered to.\n *\n * **Collision is not a concern**, even on a `.isUnique()` field: every unique index on a\n * retention-governed resource is scoped to NON-RETAINED rows, and the scrub flips the row to\n * `RETAINED` in the same write, so scrubbed rows leave the index.\n *\n * Declaring it alongside a non-`MASK` treatment is a config error — nothing would ever write it.\n * That check lives in the saas-models boot guard, which is the layer that knows `RedactionType`.\n */\n maskValue?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// VIRTUAL FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * Parameters passed to virtual field calculation functions.\n * The `utils` is typed as `any` in shared-lib but will be properly typed at runtime in backend-lib.\n */\nexport interface VirtualFieldCalculationParams<TObject = any, TContext = any, TUserContext = any> {\n /** The current resource object */\n currentObject: TObject;\n /** The resource context (parent/child relationships) - only if needsObjectContext is true */\n objectContext?: TContext;\n /** The user context - only if needsUserContext is true */\n userContext?: TUserContext;\n /** The execution context containing user, organization, etc. */\n executionContext: any;\n /**\n * Utility services for calculations.\n * Typed as `any` in shared-lib, but at runtime provides:\n * - repositories: RepositoryRegistry\n * - logger: LoggerService\n * - errorBuilder: ErrorBuilderBackendService\n * - dateService: DateService\n * - getService: <T>(symbol: symbol) => T\n */\n utils: any;\n}\n\n/**\n * Parameters for the isVirtual decorator.\n * Virtual fields are computed at runtime and not stored in the database.\n */\nexport interface VirtualFieldParams<TObject = any, TResult = any> {\n /**\n * The calculation function that computes this virtual field's value.\n * Called at runtime by VirtualFieldsBackendService with injected utilities.\n */\n calculate: (params: VirtualFieldCalculationParams<TObject>) => TResult | Promise<TResult>;\n\n /**\n * If true, the objectContext (parent/child relationships) will be passed to calculate().\n * Setting this to true has a performance cost as it requires fetching related resources.\n */\n needsObjectContext?: boolean;\n\n /**\n * If true, the userContext will be passed to calculate().\n * Setting this to true requires additional context resolution.\n */\n needsUserContext?: boolean;\n\n /**\n * Optional list of field names this virtual field depends on.\n * Used for documentation and potential future optimizations.\n */\n dependencies?: string[];\n}\n\n//------------------------------------------------------------------------------------------------\n// DISCRIMINATOR FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Parameters for the isDiscriminator decorator.\n * Marks a field as the discriminator for a discriminated union schema.\n */\nexport interface DiscriminatorFieldParams {\n /**\n * Values for which the base schema is used (no extended variant).\n * If not provided, auto-detected from enum values not covered by variants.\n */\n baseValues?: string[];\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// UNIQUE FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Scope for unique constraint enforcement.\n * - 'global': Unique across the entire collection (default)\n * - 'organization': Unique within an organization (compound index with organizationId)\n * - 'user': Unique per user (compound index with createdByUserId)\n */\nexport const UniqueScope = {\n GLOBAL: 'global',\n ORGANIZATION: 'organization',\n USER: 'user',\n} as const;\nexport type UniqueScope = typeof UniqueScope[keyof typeof UniqueScope];\n\n/**\n * Parameters for the isUnique decorator.\n * Marks a field as unique in the database with unique index.\n * MongoDB will enforce uniqueness and throw E11000 duplicate key error on violations.\n */\nexport interface UniqueFieldParams {\n /**\n * Scope for uniqueness constraint.\n * - 'global': Unique across the entire collection (default)\n * - 'organization': Unique per organization (compound index with organizationId)\n * - 'user': Unique per user (compound index with createdByUserId)\n */\n scope?: UniqueScope;\n\n /**\n * Create a compound unique index with another field in the same schema.\n * The referenced field name is resolved against the actual schema fields,\n * handling polymorphic field renames automatically.\n *\n * @example poolKey: z.string().isUnique({ compoundWith: 'billingAccountId' })\n * // Creates compound unique index: { billingAccountId: 1, poolKey: 1 }\n * // For polymorphic variants, resolves e.g. to: { organizationBillingAccountId: 1, poolKey: 1 }\n */\n compoundWith?: string;\n\n /**\n * Whether to allow null values without triggering uniqueness.\n * MongoDB unique indexes exclude null by default when sparse is true.\n * @default true\n */\n sparse?: boolean;\n\n /**\n * Custom error message to show when uniqueness is violated.\n * Supports placeholder {fieldName} which is replaced with the actual field name.\n * @example \"This {fieldName} is already taken\"\n */\n errorMessage?: string;\n\n /**\n * The custom message reference the API returns when THIS field's unique index is violated.\n *\n * Without it, every duplicate-key rejection collapses to one generic conflict code, so an\n * integrator cannot tell \"that slug is taken\" from \"that invoice number is taken\" without\n * parsing a message. Naming the reference here — next to the constraint that produces it —\n * keeps one authority: the key and the error it raises cannot drift apart.\n *\n * Pass a member of the framework's error-reference vocabulary, never a bare literal.\n *\n * @example slug: z.string().isUnique({ conflictMessageReference: ErrorCustomMessageReference.ORGANIZATION_SLUG_EXISTS })\n */\n conflictMessageReference?: string;\n}\n\n/**\n * Parameters for the object-level `businessKeySet([...])` decorator.\n *\n * Declares a **composite business key**: the ordered list of `fields` is the stable identity of a\n * row, used both by seeding upsert / upgrade / sync passes to find an existing row independently\n * from its random `_id`, and by the storage adapter to materialize a compound UNIQUE index so the\n * identity is enforced by the database rather than by a race-prone read-then-write.\n *\n * - `fields` must be non-empty and every entry must be a key declared on the\n * underlying `ZodObject` shape (validated at decoration time).\n * - This decorator is **mutually exclusive** with field-level `isBusinessKey()`\n * on the same schema — pick one identity model.\n *\n * @example\n * // \"one membership per user per organization\"\n * z.object({ userId: z.string(), organizationId: z.string(), roles: z.array(z.string()) })\n * .businessKeySet(['userId', 'organizationId'])\n */\nexport interface BusinessKeySetParams {\n fields: string[];\n\n /**\n * Fields whose ABSENCE takes a row out of the uniqueness constraint entirely.\n *\n * By default a missing member counts as a real value, so two rows that both omit it COLLIDE.\n * That is the correct default for an identity whose members are always meaningful — two rows\n * that are \"unscoped\" in the same way really are the same row.\n *\n * It is wrong when a member is optional in the domain sense: \"unit code, unique among siblings\"\n * must still allow any number of siblings that carry NO code. Listing that field here scopes the\n * constraint to the rows that actually have it.\n *\n * Every entry must also appear in `fields`. List only the members whose absence means \"this row\n * has no key\", never merely \"this member happens to be optional\" — a field left out of the list\n * keeps the default null-collides behaviour, which is what most composite keys want.\n *\n * @example\n * // many code-less siblings are fine; two siblings sharing a code are not\n * .businessKeySet(['organizationId', 'parentUnitId', 'code'], { skipRowsMissing: ['code'] })\n */\n skipRowsMissing?: string[];\n\n /**\n * The custom message reference the API returns when THIS key's unique index is violated.\n *\n * Without it, every duplicate-key rejection collapses to one generic conflict code, so an\n * integrator cannot tell which identity was violated without parsing a message. Naming the\n * reference here — next to the key that produces it — keeps one authority: the key and the error\n * it raises cannot drift apart.\n *\n * Pass a member of the framework's error-reference vocabulary, never a bare literal.\n */\n conflictMessageReference?: string;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// TTL FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Parameters for the ttl decorator.\n * Marks a Date field for TTL (Time To Live) expiration in MongoDB.\n * MongoDB will automatically delete documents when the TTL expires.\n *\n * @example\n * createdAt: z.date().ttl({ expireAfterSeconds: 3600 }) // Expire 1 hour after createdAt\n *\n * @example\n * expiresAt: z.date().ttl({ expireAfterSeconds: 0 }) // Expire at the exact date value\n */\nexport interface TtlFieldParams {\n /**\n * Number of seconds after the field's date value when the document should be deleted.\n * - 0: Document expires at the exact date/time stored in the field\n * - N > 0: Document expires N seconds after the date/time stored in the field\n *\n * @example\n * // Expire documents 24 hours after createdAt\n * createdAt: z.date().ttl({ expireAfterSeconds: 86400 })\n *\n * @example\n * // Expire documents at the exact expiresAt date\n * expiresAt: z.date().ttl({ expireAfterSeconds: 0 })\n */\n expireAfterSeconds: number;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// OTP FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * Parameters for the isOtp decorator.\n * Configures the OTP (One-Time Password) input field behavior.\n */\nexport interface OtpFieldParams {\n /**\n * Maximum length of the OTP code.\n * Determines how many input slots are rendered.\n *\n * @default 6\n *\n * @example\n * // 6-digit OTP code\n * otpCode: z.string().isOtp()\n *\n * @example\n * // 4-digit PIN\n * pin: z.string().isOtp({ maxLength: 4 })\n */\n maxLength?: number;\n}\n\n//------------------------------------------------------------------------------------------------\n// SUMMARY FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Parameters for the isSummaryField decorator.\n * Controls how summary fields are handled, particularly for foreign key population.\n */\nexport interface SummaryFieldParams {\n /**\n * Whether to populate this foreign key field with the related resource's summary data.\n * Only applicable when the field also has isForeignKey() decorator.\n *\n * When true:\n * - The related resource will be fetched using the resourceIdentifier naming convention\n * - Only the related resource's isSummaryField fields will be included\n * - The populated data is optional (null if the related resource doesn't exist)\n *\n * @default false\n *\n * @example\n * // Field definition:\n * userId: z.string().isForeignKey().isSummaryField({ populate: true })\n *\n * // LIST/SEARCH response will include:\n * {\n * _id: \"123\",\n * userId: \"user-456\",\n * user: { _id: \"user-456\", email: \"...\", displayName: \"...\" } // populated summary\n * }\n */\n populate?: boolean;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// FORM VALIDATION DECORATOR PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * Validation mode for form fields.\n * Configures when field validation is triggered.\n * - ON_CHANGE: Validate on every change (with debounce for text fields)\n * - ON_BLUR: Validate when field loses focus (default for text fields)\n * - ON_TOUCHED: Validate on blur initially, then on every change once touched\n * - ON_SUBMIT: Validate only on form submission\n */\nexport enum ValidationMode {\n ON_CHANGE = 'onChange',\n ON_BLUR = 'onBlur',\n ON_TOUCHED = 'onTouched',\n ON_SUBMIT = 'onSubmit',\n}\n\n/**\n * Trigger mechanism for autosave.\n * - DEBOUNCE: Save after a delay following the last change\n * - BLUR: Save when field loses focus\n * - NONE: Disable autosave for this field\n */\nexport enum AutosaveTrigger {\n DEBOUNCE = 'debounce',\n BLUR = 'blur',\n NONE = 'none',\n}\n\nexport interface AutosaveFieldParams {\n /**\n * Whether autosave is enabled for this field.\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Trigger mechanism for autosave.\n * - AutosaveTrigger.DEBOUNCE: Save after a delay following the last change\n * - AutosaveTrigger.BLUR: Save when field loses focus\n * - AutosaveTrigger.NONE: Disable autosave for this field\n * @default AutosaveTrigger.DEBOUNCE\n */\n trigger?: AutosaveTrigger;\n\n /**\n * Debounce delay in milliseconds (only for DEBOUNCE trigger).\n * @default 500\n */\n debounceMs?: number;\n}\n/** @wildo_source:part:end zod.decorators.structural-lifecycle-params */\n\n// ==========================================================================================================================================================\n// SHOW WHEN TYPES (FIX-P5-H1)\n// ==========================================================================================================================================================\n\n/**\n * @wildo_source:part:start zod.decorators.conditional-visibility facet:layer:frontend facet:family:form facet:surface:conditional\n *\n * FIX-P5-H1: Operator for showWhen condition comparison.\n * - EQUALS: Field value equals the specified value\n * - NOT_EQUALS: Field value does not equal the specified value\n * - IN: Field value is in the specified array\n * - NOT_IN: Field value is not in the specified array\n * - EXISTS: Field value exists (is defined and not null)\n * - NOT_EXISTS: Field value does not exist (undefined or null)\n */\nexport enum ShowWhenOperator {\n EQUALS = 'equals',\n NOT_EQUALS = 'notEquals',\n IN = 'in',\n NOT_IN = 'notIn',\n EXISTS = 'exists',\n NOT_EXISTS = 'notExists',\n}\n\n/**\n * FIX-P5-H1: A single condition for showWhen decorator.\n * The field is visible when this condition is satisfied.\n */\nexport interface ShowWhenCondition {\n /** Field name to watch for changes */\n field: string;\n\n /**\n * Value(s) that satisfy the condition.\n * For EQUALS/NOT_EQUALS: single value or array\n * For IN/NOT_IN: array of values\n * For EXISTS/NOT_EXISTS: ignored\n */\n value?: unknown | unknown[];\n\n /**\n * Comparison operator.\n * @default ShowWhenOperator.EQUALS\n */\n operator?: ShowWhenOperator;\n}\n\n/**\n * FIX-P5-H1: Parameters for the showWhen decorator.\n * Configures conditional visibility for form fields.\n *\n * Available on every form-field type — each primitive, plus object and array, plus the `optional` /\n * `default` / `nullable` wrappers — matching `ZodDecorator_ApplyableType[SHOW_WHEN]`. The bare form\n * below is the documented one and works as written; before 2026-08-12 it threw, because the\n * decorator was installed on the wrapper prototypes only.\n *\n * @example\n * ```ts\n * // Show when 'type' field equals 'advanced'\n * advancedOption: z.string().showWhen({\n * conditions: { field: 'type', value: 'advanced' }\n * })\n *\n * // Show when 'type' is one of multiple values\n * featureOption: z.string().showWhen({\n * conditions: { field: 'type', value: ['pro', 'enterprise'], operator: ShowWhenOperator.IN }\n * })\n *\n * // On a defaulted field — the shape used by Wonder Todos' `reminder.leadTimeMinutes`\n * leadTimeMinutes: z.number().int().default(30).showWhen({\n * conditions: { field: 'enabled', value: true }\n * })\n *\n * // Show when both conditions are met\n * premiumFeature: z.string().showWhen({\n * conditions: [\n * { field: 'type', value: 'enterprise' },\n * { field: 'hasPremium', value: true }\n * ],\n * combineWith: 'and'\n * })\n * ```\n */\nexport interface ShowWhenParams {\n /**\n * Condition(s) that control visibility.\n * Can be a single condition or array of conditions.\n */\n conditions: ShowWhenCondition | ShowWhenCondition[];\n\n /**\n * How to combine multiple conditions.\n * - 'and': All conditions must be true (default)\n * - 'or': Any condition must be true\n * @default 'and'\n */\n combineWith?: 'and' | 'or';\n}\n/** @wildo_source:part:end zod.decorators.conditional-visibility */\n\n// ==========================================================================================================================================================\n// APP SCOPE FIELD TYPES\n// ==========================================================================================================================================================\n\n\n// ==========================================================================================================================================================\n// DRAFT CONFIG TYPES\n// ==========================================================================================================================================================\n\n/**\n * Parameters for the isDraftable decorator.\n * Configures draft mode behavior at the schema level.\n */\nexport interface DraftableConfigParams {\n /**\n * Field name that indicates draft status (discriminator).\n * @example 'status'\n */\n discriminator: string;\n\n /**\n * Value of the discriminator field that indicates draft mode.\n * @example 'DRAFT'\n */\n draftValue: string;\n\n /**\n * Value of the discriminator field that indicates published status.\n * If not provided, publishing will remove the discriminator field.\n * @example 'PUBLISHED'\n */\n publishedValue?: string;\n\n /**\n * Whether to require confirmation dialog before publishing.\n * @default false\n */\n requireConfirmationToPublish?: boolean;\n}\n\n\n// ==========================================================================================================================================================\n// PRIMITIVE UI DECORATOR TYPES — new unified {primitive}UI API (per ui-decorator-reorganization-analysis.md §3)\n// ==========================================================================================================================================================\n\n//------------------------------------------------------------------------------------------------\n// FORCE HIDE CONFIG — controls chrome sub-element visibility\n//------------------------------------------------------------------------------------------------\n\n/**\n * Force-hide specific chrome sub-elements in display context.\n * Display has no `error` sub-element to hide.\n */\nexport interface ForceHideDisplayConfig {\n label?: boolean;\n description?: boolean;\n}\n\n/**\n * Force-hide specific chrome sub-elements in edit context.\n * Extends display with `error` (form-specific).\n */\nexport interface ForceHideConfig extends ForceHideDisplayConfig {\n error?: boolean;\n}\n\n//------------------------------------------------------------------------------------------------\n// BOOLEAN LABELLING — custom label params for boolean fields\n//------------------------------------------------------------------------------------------------\n\n/**\n * Custom labelling for boolean true/false values when enum presets\n * (BooleanLabellingValue) are insufficient.\n */\nexport interface BooleanLabellingCustomParams {\n mode: 'custom';\n trueValue: string;\n falseValue: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// PRIMITIVE UI BASE PARAMS — shared across all {primitive}UI decorators\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.primitive-ui\n *\n * Display-context base params.\n * Controls chrome, inline editing, and tooltip behavior when a field is rendered in a read-only view.\n */\nexport interface PrimitiveUIBaseDisplayParams {\n /** Override the display widget for this field (cross-cutting). Type-specific `displayMode` takes precedence. */\n component?: DisplayFieldComponent;\n\n /** Chrome layout mode for the field wrapper in display context. */\n chromeMode?: ResponsiveAware<DisplayChromeMode>;\n\n /** Force-hide specific chrome sub-elements in display context. Plain object = all breakpoints. */\n forceHide?: ResponsiveAware<ForceHideDisplayConfig>;\n\n /** Whether to show a tooltip icon in display chrome. Text comes from i18n. */\n tooltip?: boolean;\n\n /**\n * When `true`, the field is omitted entirely from the DISPLAY (read) surface\n * whenever its value is empty — null, undefined, an empty string, or an empty\n * array. The whole row (label + chrome + em-dash placeholder) is removed, not\n * just the value.\n *\n * DISPLAY-ONLY: the edit form always renders the field so an empty value can\n * still be filled in. This is the field-level counterpart to the section-level\n * `SectionConfigBase.hideWhenEmpty` and to the surface-policy\n * `AutoEmptyValue.HIDDEN` — use it to keep optional metadata (a job title, a\n * secondary contact) from cluttering a read view when unset.\n *\n * @example\n * // Hide the \"Title\" row on the profile read view until the user sets one:\n * schemaShape.title.stringUI({ display: { hideWhenEmpty: true } })\n */\n hideWhenEmpty?: boolean;\n\n /**\n * Opt-in for description text below the field value in display mode.\n * When true, the companion generates an i18n key for the description.\n * Absorbed from the deleted `.displayField({ showDescription })` decorator.\n */\n showDescription?: boolean;\n\n /**\n * Inline editing configuration. When set, the display value becomes editable in-place.\n */\n inlineEditable?: boolean | {\n mode?: InlineEditMode;\n saveOn?: InlineEditSaveOn;\n showSaveButton?: boolean;\n showCancelButton?: boolean;\n };\n}\n\n/**\n * Edit-context base params.\n * Controls chrome, validation, autosave, and focus behavior when a field is rendered in a form.\n */\nexport interface PrimitiveUIBaseEditParams {\n /** Override the form widget for this field (cross-cutting). Type-specific `editMode` takes precedence. */\n component?: FormFieldComponent;\n\n /** Chrome layout mode for the field wrapper in edit context. */\n chromeMode?: ResponsiveAware<EditChromeMode>;\n\n /** Force-hide specific chrome sub-elements in edit context. Plain object = all breakpoints. */\n forceHide?: ResponsiveAware<ForceHideConfig>;\n\n /** Whether to show a tooltip icon in form chrome. Text comes from i18n. */\n tooltip?: boolean;\n\n /** Auto-focus this field when the form mounts. */\n autoFocus?: boolean;\n\n /** Official HTML autocomplete field identifier for browser autofill. */\n autoComplete?: AutocompleteFieldIdentifier;\n\n /**\n * Optional official HTML autocomplete modifiers.\n * Supports a single modifier or an array. `section-*` is intentionally excluded\n * from this typed contract and can be added later via a dedicated API if needed.\n */\n autoCompleteModifier?: AutocompleteModifier | AutocompleteModifier[];\n\n /**\n * Opt-in for description/helper text below the form input in edit mode.\n * When true, the companion generates an i18n key for the description.\n * Absorbed from the deleted `.displayField({ showDescription })` decorator.\n */\n showDescription?: boolean;\n\n /** When to trigger validation. Falls back to resource-level defaultValidationMode. */\n validationMode?: ValidationMode;\n\n /** Autosave config for this field. Falls back to resource-level defaultAutosave. */\n autosave?: AutosaveFieldParams | true;\n}\n\n/**\n * Top-level base for all {primitive}UI decorators.\n * Splits configuration by UI context: display (detail views), summaryOverride (cards/lists), edit (forms).\n */\nexport interface PrimitiveUIBaseParams {\n /** Config for Display context (detail/read-only views). Primary display config. */\n display?: PrimitiveUIBaseDisplayParams;\n\n /** Config for DisplaySummary context (cards, list items, FK references). Overrides display defaults when rendering in summary. */\n summaryOverride?: PrimitiveUIBaseDisplayParams;\n\n /** Config for Edition context (forms). */\n edit?: PrimitiveUIBaseEditParams;\n}\n/** @wildo_source:part:end zod.decorators.primitive-ui */\n\n/**\n * @wildo_source:part:start zod.decorators.per-primitive-ui facet:layer:frontend facet:family:ui facet:surface:form facet:surface:display\n *\n * Per-primitive frontend UI decorator parameter types.\n *\n * These interfaces define the arguments accepted by decorators such as\n * `.stringUI()`, `.numberUI()`, `.enumUI()`, `.booleanUI()`, `.moneyUI()`,\n * `.foreignKeyUI()`, etc.\n *\n * They belong to the frontend resource behavior layer, not to shared resource\n * schemas. In application code, they are typically authored in files like:\n * `frontend/src/modules/<module>/resources/<resource>/<resource>.ui-behavior.tsx`\n *\n * The shared schema establishes structural meaning (`isSummaryField`,\n * `isForeignKey`, `excludeFromUpdate`, ...). These UI parameter types control\n * presentation concerns such as display widgets, edit widgets, chrome modes,\n * per-enum colors/icons, inline editing, and layout details.\n *\n * Generated framework knowledge should prefer extracting these definitions from\n * source rather than restating the supported UI parameters in handcrafted\n * markdown documents.\n */\n//------------------------------------------------------------------------------------------------\n// BOOLEAN UI\n//------------------------------------------------------------------------------------------------\n\nexport interface BooleanUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. RAW = plain text, CHECKMARK = checkmark/cross, EDIT_LIKE = shows the edit control read-only. */\n displayMode?: BooleanDisplayMode;\n}\n\nexport interface BooleanUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. TOGGLE = pill, SWITCH = iOS-style, CHECKBOX = classic, RADIO = two options. */\n editMode?: BooleanEditMode;\n}\n\nexport interface BooleanUIParams {\n /**\n * Labels for true/false values (cross-context — applies to display and edit).\n * Use BooleanLabellingValue enum presets or BooleanLabellingCustomParams for literal labels.\n */\n labellingValue?: BooleanLabellingValue | BooleanLabellingCustomParams;\n display?: BooleanUIDisplayParams;\n summaryOverride?: BooleanUIDisplayParams;\n edit?: BooleanUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// STRING UI\n//------------------------------------------------------------------------------------------------\n\nexport interface StringUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. TEXT | TRUNCATE | MULTILINE | MARKDOWN | COLOR | LINK | EMAIL | BADGE | COPY | SECRET. */\n displayMode?: StringDisplayMode;\n /** Max characters before truncation (TRUNCATE displayMode only). */\n truncateLength?: number;\n /**\n * SECRET displayMode only: render the value revealed (not masked) on first\n * paint. Defaults to `false` (masked, reveal via the eye toggle) for secrets\n * shown in persistent surfaces. `.isEphemeral()` sets this `true` because an\n * ephemeral one-time-reveal exists precisely so the caller can read + copy the\n * secret immediately; the toggle still lets them re-hide it.\n */\n initiallyRevealed?: boolean;\n}\n\nexport interface StringUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. INPUT | TEXTAREA | COLOR | PASSWORD | OTP. */\n editMode?: StringEditMode;\n /** Number of rows for TEXTAREA editMode. */\n textareaRows?: number;\n}\n\nexport interface StringUIParams {\n display?: StringUIDisplayParams;\n summaryOverride?: StringUIDisplayParams;\n edit?: StringUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// NUMBER UI\n//------------------------------------------------------------------------------------------------\n\nexport interface NumberUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. RAW | FORMATTED | PERCENTAGE | COMPACT | ORDINAL | BYTES. */\n displayMode?: NumberDisplayMode;\n}\n\nexport interface NumberUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. INPUT | SLIDER | STEPPER. */\n editMode?: NumberEditMode;\n}\n\nexport interface NumberUIParams {\n /** Number of decimal places (cross-context). */\n decimalPlaces?: number;\n /** Whether to show trailing zeros (e.g., 1.00 vs 1). */\n trailingZeros?: boolean;\n /** Prefix string displayed before the value (e.g., \"$\", \"€\"). */\n prefix?: string;\n /** Suffix string displayed after the value (e.g., \"kg\", \"%\", \"px\"). */\n suffix?: string;\n /** How to interpret percentage values: NORMALIZED (0–1) or PERCENT (0–100). */\n percentageScale?: PercentageScale;\n display?: NumberUIDisplayParams;\n summaryOverride?: NumberUIDisplayParams;\n edit?: NumberUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// ENUM UI\n//------------------------------------------------------------------------------------------------\n\nexport interface EnumUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. TEXT | BADGE | ICON | CARD. */\n displayMode?: EnumDisplayMode;\n}\n\nexport interface EnumUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. SELECT | RADIO | RADIO_ICON_ONLY | TOGGLE | TOGGLE_ICON_ONLY | CARD | CARD_ICON_ONLY | COMBOBOX. */\n editMode?: EnumEditMode;\n /** Direction of radio/toggle/checkbox group. Renamed from `layout`. */\n editDirection?: LayoutDirection;\n /** Number of grid columns for radio/toggle/card groups. Renamed from `columns`. */\n editColumnsCount?: number;\n}\n\nexport interface EnumUIParams {\n /** Per-value display config (cross-context — colors and icons used in both display badges and edit controls). */\n values?: Record<string, EnumValueDisplayConfig>;\n /** Default badge color when no per-value override (cross-context). */\n defaultColor?: BadgeSemanticVariant;\n /** Default icon when no per-value override (cross-context). */\n defaultIcon?: IconLike;\n display?: EnumUIDisplayParams;\n summaryOverride?: EnumUIDisplayParams;\n edit?: EnumUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// DATE / DATETIME / TIME UI\n//------------------------------------------------------------------------------------------------\n\nexport type DateUIDisplayParams = PrimitiveUIBaseDisplayParams;\nexport type DateUIEditParams = PrimitiveUIBaseEditParams;\nexport interface DateUIParams {\n display?: DateUIDisplayParams;\n summaryOverride?: DateUIDisplayParams;\n edit?: DateUIEditParams;\n}\n\nexport type DateTimeUIDisplayParams = PrimitiveUIBaseDisplayParams;\nexport type DateTimeUIEditParams = PrimitiveUIBaseEditParams;\nexport interface DateTimeUIParams {\n display?: DateTimeUIDisplayParams;\n summaryOverride?: DateTimeUIDisplayParams;\n edit?: DateTimeUIEditParams;\n}\n\nexport type TimeUIDisplayParams = PrimitiveUIBaseDisplayParams;\nexport type TimeUIEditParams = PrimitiveUIBaseEditParams;\nexport interface TimeUIParams {\n display?: TimeUIDisplayParams;\n summaryOverride?: TimeUIDisplayParams;\n edit?: TimeUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// MONEY UI\n//------------------------------------------------------------------------------------------------\n\nexport type MoneyUIDisplayParams = PrimitiveUIBaseDisplayParams;\n\nexport interface MoneyUIEditParams extends PrimitiveUIBaseEditParams {\n /** Initial/default currency shown in the picker. Moved from z_money(). ISO 4217. */\n defaultCurrency?: AvailableCurrency;\n}\n\nexport interface MoneyUIParams {\n display?: MoneyUIDisplayParams;\n summaryOverride?: MoneyUIDisplayParams;\n edit?: MoneyUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// CODE UI\n//------------------------------------------------------------------------------------------------\n\nexport interface CodeUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Show line numbers in display context. */\n showLineNumbers?: boolean;\n}\n\nexport interface CodeUIEditParams extends PrimitiveUIBaseEditParams {\n /** Show line numbers in editor. */\n showLineNumbers?: boolean;\n}\n\nexport interface CodeUIParams {\n /** Enable syntax highlighting (cross-context). */\n syntaxHighlighting?: boolean;\n /** Default language for the code editor/display (cross-context). Must be in allowedLanguages (from z_code()). */\n defaultLanguage?: CodeLanguage;\n display?: CodeUIDisplayParams;\n summaryOverride?: CodeUIDisplayParams;\n edit?: CodeUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// FILE UI\n//------------------------------------------------------------------------------------------------\n\nexport interface FileUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /**\n * How the file renders AT REST — see {@link FileDisplayPresentation}. Media display\n * is never mandatory: the default is the neutral file card, and `THUMBNAIL`/`FULL`\n * are opt-in. Rendered media is fetched over the authenticated resource-integrated\n * serve route (authz inherits the parent READ).\n * @default FileDisplayPresentation.CARD\n */\n presentation?: FileDisplayPresentation;\n /**\n * What activating the file does — see {@link FileActivationConfig}. Applies to every\n * nature. Omit for the nature-derived default: `OVERLAY` when a displayer exists for\n * the resolved nature, `DOWNLOAD` otherwise.\n */\n activation?: FileActivationConfig;\n /**\n * Presentation detail for rendered media (shape / size / caption). Applies when\n * `presentation` is `THUMBNAIL` or `FULL`; ignored by `CARD`.\n * @example { shape: FileMediaShape.CIRCLE, size: FileMediaSize.MD, showCaption: false } // avatar\n */\n preview?: FileMediaPreviewOptions;\n}\nexport type FileUIEditParams = PrimitiveUIBaseEditParams;\nexport interface FileUIParams {\n display?: FileUIDisplayParams;\n summaryOverride?: FileUIDisplayParams;\n edit?: FileUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// DURATION UI\n//------------------------------------------------------------------------------------------------\n\nexport type DurationUIDisplayParams = PrimitiveUIBaseDisplayParams;\n\nexport interface DurationUIEditParams extends PrimitiveUIBaseEditParams {\n /** Default unit shown in the picker. Must be in allowedUnits (from z_duration()). */\n defaultUnit?: DurationUnit;\n}\n\nexport interface DurationUIParams {\n display?: DurationUIDisplayParams;\n summaryOverride?: DurationUIDisplayParams;\n edit?: DurationUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// PHONE UI\n//------------------------------------------------------------------------------------------------\n\nexport type PhoneUIDisplayParams = PrimitiveUIBaseDisplayParams;\nexport type PhoneUIEditParams = PrimitiveUIBaseEditParams;\n\nexport interface PhoneUIParams {\n /**\n * Overrides factory defaultCountry for UI rendering (cross-context).\n * ISO 3166-1 alpha-2 code. Typed as string at this layer; consumers should use AvailableCountry\n * from presets-components-models for type safety.\n */\n displayCountry?: string;\n display?: PhoneUIDisplayParams;\n summaryOverride?: PhoneUIDisplayParams;\n edit?: PhoneUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// BIGDECIMAL UI\n//------------------------------------------------------------------------------------------------\n\nexport interface BigDecimalUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. RAW | FORMATTED | PERCENTAGE. */\n displayMode?: BigDecimalDisplayMode;\n}\n\nexport interface BigDecimalUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. Only INPUT for arbitrary precision. */\n editMode?: BigDecimalEditMode;\n /** Default value shown in the editor before user interaction. Moved from bigDecimalConfig. */\n defaultValue?: string;\n}\n\nexport interface BigDecimalUIParams {\n /** Number of decimal places (cross-context). */\n decimalPlaces?: number;\n /** Whether to show trailing zeros (e.g., 1.00 vs 1). */\n trailingZeros?: boolean;\n /** Prefix string displayed before the value (e.g., \"$\", \"€\"). */\n prefix?: string;\n /** Suffix string displayed after the value (e.g., \"kg\", \"%\", \"px\"). */\n suffix?: string;\n /** How to interpret percentage values: NORMALIZED (0–1) or PERCENT (0–100). */\n percentageScale?: PercentageScale;\n display?: BigDecimalUIDisplayParams;\n summaryOverride?: BigDecimalUIDisplayParams;\n edit?: BigDecimalUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// FOREIGN KEY UI\n//------------------------------------------------------------------------------------------------\n\nexport interface ForeignKeyUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** How to render the FK reference. ID | LABEL | SUMMARY. */\n mode?: ForeignKeyDisplayMode;\n /** Whether the displayed FK value is a clickable link to the referenced resource. */\n linkable?: boolean;\n /** Override the preset used to display the referenced resource summary. */\n displayPresetOverride?: string;\n}\n\nexport interface ForeignKeyUIEditParams extends PrimitiveUIBaseEditParams {\n /**\n * How each RESULT in the reference picker's dropdown renders — applies to both\n * the form picker and the collection filter picker (they share one component):\n * - `LABEL` (default): a one-line resource label (via `getFrontendResourceLabel`).\n * - `SUMMARY`: the referenced resource's summary view — its summary fields with\n * NO action bar — rendered via `ResourceSummaryDisplayer`.\n * `ID` is treated as `LABEL` here (a raw id is not a useful picker row). Only the\n * dropdown options are affected; the selected value still shows as a label.\n */\n optionDisplayMode?: ForeignKeyDisplayMode;\n}\n\nexport interface ForeignKeyUIParams {\n display?: ForeignKeyUIDisplayParams;\n summaryOverride?: ForeignKeyUIDisplayParams;\n edit?: ForeignKeyUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// ARRAY UI\n//------------------------------------------------------------------------------------------------\n\nexport interface ArrayUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Direction for rendering items in display context. */\n displayMode?: DisplayDirection;\n /** Max items shown in display (rest truncated). */\n maxItems?: number;\n}\n\n/**\n * How NEW items are added to an array field in an edit / inline-edit surface.\n *\n * When unset, the renderer resolves a default by item shape: a SIMPLE item\n * (a primitive, or an object with a single prominent authored field — e.g. a\n * checklist `{ label, done }`) defaults to {@link ArrayAddMode.QUICK_ADD}; a\n * MULTI-field object defaults to {@link ArrayAddMode.APPEND_INLINE}.\n *\n * The key distinction is WHEN the new item is validated:\n * - `APPEND_INLINE` validates AFTER append (a freshly-added required field shows\n * its error until filled);\n * - `QUICK_ADD` / `DIALOG` validate BEFORE append (the list never holds a blank\n * or invalid item).\n */\nexport enum ArrayAddMode {\n /**\n * \"+ Add\" appends a blank, in-place editable item card/row; validated AFTER\n * it is added. Best for rich objects the author edits in place.\n */\n APPEND_INLINE = 'append-inline',\n /**\n * A single inline add-row (the item's primary field + Enter / \"+\"). The item\n * is built from the row and validated BEFORE it is appended, so the list never\n * holds a blank/invalid item. Best for simple items — checklists.\n */\n QUICK_ADD = 'quick-add',\n /**\n * \"+ Add\" opens a dialog with the item's form; the item is validated on submit\n * and then appended. Best for complex, multi-field items.\n */\n DIALOG = 'dialog',\n}\n\nexport interface ArrayUIEditParams extends PrimitiveUIBaseEditParams {\n /** Allow reordering via drag-and-drop in edit context. Set via `.isSortable()` convenience or directly. */\n isSortable?: boolean;\n /** Enable drag-and-drop reordering (default true when isSortable). */\n dnd?: boolean;\n /** Show up/down manual move buttons. */\n upDownIcons?: boolean;\n /**\n * How new items are added (append-inline / quick-add / dialog). When unset,\n * the renderer picks a default by item shape — see {@link ArrayAddMode}.\n */\n addMode?: ArrayAddMode;\n}\n\n/**\n * How each item of an OBJECT array (`z.array(z.object({...}))`) is framed in\n * BOTH display and edit surfaces.\n *\n * - `CARD` (default) — each item is a framed card (border + padding) with a\n * floating summary chip and a stacked column of its sub-fields. Best for\n * rich, multi-field items the author edits in place.\n * - `ROW` — each item is a compact single-row: its sub-fields render inline\n * (boolean fields lead as compact toggles — the \"☐\" of a checklist — then\n * the primary field fills the row), reorder/remove controls inline, NO card\n * frame or floating chip. Best for lists of small objects — checklists,\n * tag/value pairs, key-value rows.\n *\n * Applies to object-array items only; primitive arrays already render as rows.\n */\nexport enum ArrayObjectItemLayout {\n CARD = 'card',\n ROW = 'row',\n}\n\nexport interface ArrayUIParams {\n display?: ArrayUIDisplayParams;\n summaryOverride?: ArrayUIDisplayParams;\n edit?: ArrayUIEditParams;\n /**\n * How OBJECT-array items are framed (card vs compact row). Governs display\n * AND edit/inline-edit rendering. Defaults to {@link ArrayObjectItemLayout.CARD}.\n * No effect on primitive arrays. See {@link ArrayObjectItemLayout}.\n */\n objectItemLayout?: ArrayObjectItemLayout;\n}\n\n//------------------------------------------------------------------------------------------------\n// OBJECT UI\n//------------------------------------------------------------------------------------------------\n\nexport interface ObjectUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Direction for rendering properties in display context. */\n displayMode?: DisplayDirection;\n /** Max properties shown in display (rest truncated). */\n maxItems?: number;\n}\n\nexport type ObjectUIEditParams = PrimitiveUIBaseEditParams;\n\nexport interface ObjectUIParams {\n display?: ObjectUIDisplayParams;\n summaryOverride?: ObjectUIDisplayParams;\n edit?: ObjectUIEditParams;\n}\n/** @wildo_source:part:end zod.decorators.per-primitive-ui */\n\n//================================================================================================\n// FIELD SPEC — Per-primitive business semantics decorators (companion-only at runtime)\n//================================================================================================\n\n/**\n * @wildo_source:part:start zod.decorators.field-spec-params facet:layer:specification facet:family:companion facet:family:semantics\n *\n * Semantic specification parameter types for companion/specification overlays.\n *\n * These types are intentionally separate from both:\n * - shared schema structural decorators (`*.schemas.ts`)\n * - frontend UI decorators (`*.ui-behavior.tsx`)\n *\n * `{primitive}Spec()` calls belong in specification-side files such as\n * `specifications/src/modules/<module>/resources/<resource>.resource.specification.ts`.\n * They enrich schema fields with business meaning, importance, enum value\n * semantics, relationship context, and import-oriented symbol references used by\n * companion-time reasoning and code generation.\n *\n * These params should carry meaning that cannot be deterministically inferred\n * from the Zod type, requiredness, or structural decorators alone.\n */\n\n/**\n * Relative weight of a semantic entry inside its owning resource.\n *\n * Not about technical optionality — tells the AI how central a field is\n * to understanding the resource:\n * - PRIMARY: core to understanding or using the resource correctly.\n * The AI should prioritize these in summaries, forms, and behavior generation.\n * - CONTEXTUAL: provides useful context but is not central.\n * The AI can include or omit based on available space/attention.\n *\n * Default is CONTEXTUAL — only genuinely important fields should be explicitly\n * flagged as PRIMARY.\n */\nexport enum FieldSemanticImportance {\n PRIMARY = 'primary',\n CONTEXTUAL = 'contextual',\n}\n\n/**\n * Base field specification parameters shared by all `{primitive}Spec()` decorators.\n *\n * Carries the semantic delta that the Zod schema definition alone cannot convey:\n * domain meaning, business relevance, and guidance for the AI companion.\n *\n * These values are **never rendered in the frontend UI** — they exist on the\n * schema metadata for companion-time extraction only. The `{primitive}Spec()` calls\n * happen in the specification overlay (which the frontend never imports), so\n * the prose is attached to schema instances only in companion/test contexts.\n *\n * Do not duplicate information already expressed by the schema type, requiredness,\n * enum values, or structural decorators. This is for meaning that is not derivable.\n */\nexport enum CodeSymbolKind {\n SCHEMA = 'schema',\n ENUM = 'enum',\n FACTORY = 'factory',\n FUNCTION = 'function',\n CONFIG = 'config',\n TYPE = 'type',\n COMPONENT = 'component',\n UI_BEHAVIOR = 'uiBehavior',\n}\n\nexport enum CodeDeclarationKind {\n TYPESCRIPT_ENUM = 'typescriptEnum',\n CONST_OBJECT = 'constObject',\n ZOD_ENUM = 'zodEnum',\n LITERAL_UNION = 'literalUnion',\n ZOD_SCHEMA = 'zodSchema',\n FUNCTION = 'function',\n INTERFACE = 'interface',\n TYPE_ALIAS = 'typeAlias',\n UNKNOWN = 'unknown',\n}\n\n/**\n * Public-import-oriented symbol reference used by semantic specifications.\n *\n * Downstream transposers/prompts should prefer these refs over file-path\n * guesses so generated code imports the right public symbol.\n */\nexport interface CodeSymbolRef {\n /** Package name to import from (for example `@wildo-ai/saas-models`). */\n packageName: string;\n /** Optional public subpath when the package root is not the import target. */\n importPath?: string;\n /** Literal exported symbol name. */\n exportName: string;\n /** High-level category of symbol. */\n symbolKind: CodeSymbolKind;\n /** More specific declaration family for code-generation handling. */\n declarationKind?: CodeDeclarationKind;\n /** Optional local-path hint for companion-side tooling/debugging. */\n filePathHint?: string;\n /** Extra caveats or usage notes for downstream prompts. */\n notes?: string[];\n}\n\n/**\n * Reference to one member of a declared enum/const-object vocabulary.\n */\nexport interface CodeEnumMemberRef {\n /** Declared enum/const-object that owns the member. */\n enumDeclaration: CodeSymbolRef;\n /** Literal member name on that declaration (for example `USERS`). */\n memberName: string;\n}\n\nexport enum CollectionElementKind {\n PRIMITIVE = 'primitive',\n ENUM = 'enum',\n FOREIGN_KEY = 'foreignKey',\n OBJECT = 'object',\n SCHEMA_REF = 'schemaRef',\n UNION = 'union',\n UNKNOWN = 'unknown',\n}\n\nexport enum CodePrimitiveKind {\n STRING = 'string',\n NUMBER = 'number',\n BOOLEAN = 'boolean',\n DATE = 'date',\n DATETIME = 'datetime',\n TIME = 'time',\n MONEY = 'money',\n CODE = 'code',\n FILE = 'file',\n DURATION = 'duration',\n PHONE = 'phone',\n BIGDECIMAL = 'bigdecimal',\n UNKNOWN = 'unknown',\n}\n\n/**\n * Author-only metadata for array elements.\n *\n * `elementMeaning` (on `ArraySpecParams`) explains business semantics; this\n * shape captures the **author-only** overlays that the framework cannot\n * derive on its own: a public `enumDeclaration` for ENUM/UNION-of-ENUM\n * branches and free-form `notes`.\n *\n * This shape intentionally excludes `kind`, `primitiveType`,\n * `schemaDeclaration` and `foreignKeyTargetResource`. The schema and\n * relationship declarations already provide those structural facts, so\n * repeating them here would create two sources of truth.\n *\n * Authors keep `enumDeclaration` so the companion can render `Use member X\n * from ENUM_NAME imported via PACKAGE` lines without re-walking the enum\n * to find its public symbol — there is no Zod-side metadata that carries\n * the public import path. UNION branches that are themselves enums also\n * reuse the parent `enumDeclaration` (the dominant vocabulary).\n */\nexport interface ArrayElementTypeSpec {\n /** Named enum/const-object declaration when elements use a vocabulary. */\n enumDeclaration?: CodeSymbolRef;\n /** Extra caveats for downstream coding prompts. */\n notes?: string[];\n}\n\nexport interface FieldSpecBaseParams {\n /** Business meaning of the field: what it represents in the domain. */\n meaning: string;\n /** Why the AI should care about this field when authoring behavior or UI. */\n whyItMatters?: string;\n /** Relative weight of this field in the resource understanding. */\n importance?: FieldSemanticImportance;\n}\n\n//------------------------------------------------------------------------------------------------\n// STRING SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface StringSpecParams extends FieldSpecBaseParams {\n /** Semantic role of the string content in the domain. */\n semanticRole?: 'identifier' | 'name' | 'description' | 'content' | 'label' | 'code' | 'uri';\n}\n\n//------------------------------------------------------------------------------------------------\n// NUMBER SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface NumberSpecParams extends FieldSpecBaseParams {\n /** Business unit of the numeric value (e.g., \"days\", \"percentage\", \"count\"). */\n unit?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// BOOLEAN SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type BooleanSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// DATE / DATETIME / TIME SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface DateSpecParams extends FieldSpecBaseParams {\n /** Temporal semantic role (e.g., deadline, creation timestamp, expiration). */\n temporalRole?: 'deadline' | 'creation' | 'expiration' | 'scheduled' | 'occurred' | 'modified';\n}\n\nexport type DateTimeSpecParams = DateSpecParams;\nexport type TimeSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// ENUM SPEC\n//------------------------------------------------------------------------------------------------\n\n/** Per-value semantic meaning for an enum field. */\nexport interface EnumValueSpecConfig {\n /** What this enum value means in business terms. */\n meaning: string;\n}\n\nexport interface EnumSpecParams extends FieldSpecBaseParams {\n /** Per-value business semantics — keyed by enum value. */\n values?: Record<string, EnumValueSpecConfig>;\n /** Public declaration that owns the enum vocabulary. */\n enumDeclaration?: CodeSymbolRef;\n}\n\n//------------------------------------------------------------------------------------------------\n// MONEY SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type MoneySpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// CODE SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type CodeSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// FILE SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type FileSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// DURATION SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type DurationSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// PHONE SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type PhoneSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// BIGDECIMAL SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface BigDecimalSpecParams extends FieldSpecBaseParams {\n /** Business unit of the value (e.g., \"currency\", \"weight\", \"rate\"). */\n unit?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// FOREIGN KEY SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface ForeignKeySpecParams extends FieldSpecBaseParams {\n /** Business meaning of the relationship this FK represents. */\n relationshipContext?: string;\n /**\n * Target resource is no longer authored here.\n *\n * Schema interpretation derives the target by matching `foreignKeyField`\n * against the owning resource's relationship declarations. Author the\n * relationship and its field once in the application relationship\n * declaration; the specification then receives the resolved target without\n * a second, potentially conflicting field.\n */\n}\n\n//------------------------------------------------------------------------------------------------\n// ARRAY SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface ArraySpecParams extends FieldSpecBaseParams {\n /** Business meaning of each element in the collection. */\n elementMeaning?: string;\n /** Structural/code-handling description of each array element. */\n elementType?: ArrayElementTypeSpec;\n}\n\n//------------------------------------------------------------------------------------------------\n// OBJECT SPEC\n//------------------------------------------------------------------------------------------------\n\n/**\n * Object-spec params are intentionally identical to the base shape.\n *\n * The decorator keeps a distinct semantic identity (an `objectSpec()` call\n * marks a nested structure as field-spec-bearing for completeness checks),\n * but it carries no extra structural metadata: nested-structure shape and\n * any `schemaDeclaration` are derivable from the Zod object itself, and\n * `structureRole` overlapped with the base `meaning` field with no clear\n * delineation.\n *\n * The type intentionally adds no separate structural metadata: duplicating\n * the base semantics would make nested-object authoring ambiguous.\n */\nexport type ObjectSpecParams = FieldSpecBaseParams;\n/** @wildo_source:part:end zod.decorators.field-spec-params */\n\n\n// ==========================================================================================================================================================\n// ZOD DECORATOR TYPES\n// ==========================================================================================================================================================\n\n/**\n * @wildo_source:part:start zod.decorators.decorator-vocabulary\n *\n * Canonical string identifiers for framework Zod field decorators (`ZodDecorator` enum).\n */\nexport enum ZodDecorator {\n IS_DB_INDEXED = \"isDBIndexed\",\n IS_FOREIGN_KEY = \"isForeignKey\",\n IS_HIDDEN = \"isHidden\",\n IS_NOT_EDITABLE = \"isNotEditable\",\n // New decorators for resource derived objects rationalization\n IS_SUMMARY_FIELD = \"isSummaryField\",\n IS_BACKEND_ONLY = \"isBackendOnly\",\n IS_WRITE_ONLY_SECRET = \"isWriteOnlySecret\",\n /**\n * Impersonalization: per-field erasure-scrub treatment — a `RedactionType` value (string),\n * read by the saas-models impersonalize writer. NOT the anonymous-user concept.\n *\n * Authored fluently: `z.string().nullish().impersonalizeWith(RedactionType.REMOVE)`. The\n * treatment is REQUIRED and must be a non-empty string — a blank/missing value throws at\n * decoration time rather than silently leaving the field untreated (an unscrubbed personal\n * field). `addImpersonalizeWith(schema, treatment)` is the equivalent programmatic escape hatch;\n * read the treatment back with `getImpersonalizeTreatment(schema)`.\n *\n * A `MASK` treatment may carry a field-specific mask value —\n * `addImpersonalizeWith(schema, RedactionType.MASK, { maskValue: 'erased@erased.invalid' })` —\n * for a CONSTRAINED string the default mask constant cannot satisfy; read it back with\n * `getImpersonalizeMaskValue(schema)`. Both authoring doors normalize to\n * {@link ImpersonalizeFieldParams}, which is what this decorator stores.\n */\n IMPERSONALIZE_WITH = \"impersonalizeWith\",\n /**\n * Portability: where this field's value CAME FROM — a `DataPortabilityProvenance` value (string),\n * read by the subject-export orchestrator to decide GDPR Art. 20 scope.\n *\n * Authored fluently: `z.string().portabilityProvenance(DataPortabilityProvenance.SUBJECT_PROVIDED)`.\n * The value is REQUIRED and must be a non-empty string — a blank/missing value throws at\n * decoration time rather than storing an undeclared provenance, which an Art. 20 export treats as\n * a REFUSAL rather than guessing. `addPortabilityProvenance(schema, provenance)` is the equivalent\n * programmatic escape hatch; read it back with `getPortabilityProvenance(schema)`.\n *\n * A field that carries no declaration inherits its resource's `portabilityPolicy.defaultProvenance`;\n * only fields differing from that default need this decorator.\n *\n * ⚠️ NOT a redaction or scrub concept, and NOT the anonymous-user concept. This says where a value\n * ORIGINATED, for a DISCLOSURE decision. What happens to a value on ERASURE is\n * {@link ZodDecorator.IMPERSONALIZE_WITH}, an orthogonal axis — a field is commonly both\n * `SUBJECT_PROVIDED` and masked on erasure.\n */\n PORTABILITY_PROVENANCE = \"portabilityProvenance\",\n /**\n * Data categories: WHICH KINDS of personal data this field holds — one or more\n * `PersonalDataCategory` values (strings), read by the compliance fact producer to answer the\n * privacy-notice question \"which categories of personal data do you process\".\n *\n * Authored fluently: `email: z.email().dataCategories(PersonalDataCategory.CONTACT_DETAILS)`, or\n * with an array when a field genuinely spans two —\n * `.dataCategories([PersonalDataCategory.USER_CONTENT, PersonalDataCategory.SPECIAL_CATEGORY_HEALTH])`.\n * The chokepoint normalizes either form to a deduped array, so every reader sees one shape.\n * At least one category is REQUIRED and each must be a non-empty string: a blank declaration\n * would read back as declared-but-meaningless, which is worse than absent, because absence is\n * what the gap report is looking for. `addDataCategories(schema, categories)` is the equivalent\n * programmatic escape hatch; read them back with `getDataCategories(schema)`.\n *\n * WHETHER each value is a real `PersonalDataCategory` member is checked by the resource factory's\n * boot guard, which owns the enum — this layer knows only that non-empty strings were declared.\n *\n * ⚠️ Four adjacent axes, none of them this one. {@link ZodDecorator.IMPERSONALIZE_WITH} says what\n * happens to the value on ERASURE; {@link ZodDecorator.PORTABILITY_PROVENANCE} says where it CAME\n * FROM; `Compliance_DataClassification` is a SENSITIVITY ladder for flows-actors config; a\n * retention class says HOW LONG it is kept. A single field is routinely all five at once, and\n * none of the other four can answer \"what kind of personal data is this\".\n *\n * ⚠️ Do NOT declare a category on a field merely because its NAME suggests one. The decorator\n * exists precisely so categories are never derived from identifiers: `email`, `phone` and\n * `dateOfBirth` are suggestive while `notes` is not, and an inventory assembled by\n * pattern-matching names is a guess whose misses are silently undisclosed. `CREDENTIALS` is the\n * one category the producer derives, and it derives it from `.isPassword()` / `.isOtp()` /\n * `.isWriteOnlySecret()` — markers the author wrote, not names it read.\n *\n * assurance-control: WILDO.PRIVACY.PERSONAL_DATA_INVENTORY — the application declares which\n * categories of personal data each field holds\n */\n DATA_CATEGORIES = \"dataCategories\",\n /**\n * Audit evidence: this field's BEFORE/AFTER VALUES are recorded when a resource operation\n * mutates it, on the `resource_operation_performed` audit event.\n *\n * Authored fluently: `appRoles: z.array(z.string()).isAuditEvidence()`. A pure marker — no\n * parameters, no implied decorators. `addAuditEvidence(schema)` is the equivalent programmatic\n * escape hatch; read it back with `isAuditEvidenceField(schema)`.\n *\n * **Mark the fields whose VALUES are the evidence, and only those.** The audit event always\n * records the NAMES of every changed field (a field name is not personal data). This marker adds\n * the values, and values are the part that must be justified: audit rows replicate to the per-org\n * SIEM and to the immutable ledger, and the ledger cannot be scrubbed — so marking a personal-data\n * field manufactures an unerasable copy of it, defeating the impersonalization/retention\n * capability. Mark authority (`appRoles`, `roles`), lifecycle state (`status`), and scope-bearing\n * fields; do NOT mark names, contact details, addresses, free text, or anything a data subject\n * could ask to have erased.\n *\n * ⚠️ This is a WRITE-side claim — \"when this field CHANGES, the change itself is evidence\" — and\n * is independent of the READ-side disclosure trail. The only disclosure trigger the framework has\n * is `isBackendOnly({ isReturnedAtCreation: true })`, which fires one `FIELD_ACCESS` event when a\n * server-minted secret is first exposed. A field can carry either, both, or neither. There is no\n * general \"audit every read of this field\" marker — do not go looking for one.\n *\n * assurance-control: WILDO.SECRETS.DISCLOSURE_AUDIT\n */\n IS_AUDIT_EVIDENCE = \"isAuditEvidence\",\n /**\n * RAG source: this field's TEXT is a retrieval-corpus source. The framework chunks the value\n * (extracting text first for file fields), stores the chunks in the application's OWN datastore\n * (pgvector on PostgreSQL, `$vectorSearch` on MongoDB — never a third store), and erases them\n * with the row: chunks are a derived-data tier keyed `(resourceType, resourceId, fieldName)`,\n * so row deletion, field impersonalization, and subject erasure all reach them.\n *\n * Authored fluently: `z.string().ragSource()` or `z.string().ragSource({ chunkingStrategy:\n * RAGChunkingStrategy.MARKDOWN, chunkSize: 1200, chunkOverlap: 150 })`. All params are optional\n * and there is NO `enabled` flag — presence of the decorator IS the declaration (see\n * {@link RagSourceConfiguration}). `addRagSource(schema, config?)` is the equivalent programmatic\n * escape hatch; read the config back with `getRagSourceConfig(schema)`.\n *\n * **File fields are one text provider, not a separate mechanism.** `z_file({ ragSource: {...} })`\n * registers THIS decorator on the schema it returns, so detection is uniform across plain-text\n * and file-backed sources; file-only extraction knobs (OCR) live file-side in\n * `FileSchemaOptions.textExtraction`, never here.\n *\n * **Refused companions, enforced in BOTH application orders at the decorator chokepoint:**\n * - {@link ZodDecorator.IS_PASSWORD}, {@link ZodDecorator.IS_OTP},\n * {@link ZodDecorator.IS_WRITE_ONLY_SECRET}, {@link ZodDecorator.IS_EPHEMERAL} — a secret or\n * ephemeral value must never enter a retrieval corpus.\n * - {@link ZodDecorator.TTL} — MongoDB honours `.ttl()` natively: rows vanish with NO application\n * code running, so derived chunks of a TTL row could never be erased with their parent (plan\n * `resource-rag-capability` DL3). The refusal lifts when a sweep-cascade reconciles chunk rows\n * against vanished parents.\n *\n * {@link ZodDecorator.IS_BACKEND_ONLY} composes: a backend-only field can be a corpus source —\n * retrieval access is governed by the resource's own access binding, not by field visibility.\n * {@link ZodDecorator.IMPERSONALIZE_WITH} composes too: an impersonalize decision deletes the\n * field's chunks in the same decision.\n */\n RAG_SOURCE = \"ragSource\",\n IS_VIRTUAL = \"isVirtual\",\n IS_DISCRIMINATOR = \"isDiscriminator\",\n EXCLUDE_FROM_CREATE = \"excludeFromCreate\",\n EXCLUDE_FROM_UPDATE = \"excludeFromUpdate\",\n // Database constraint decorators\n IS_UNIQUE = \"isUnique\",\n IS_PRIMARY_KEY = \"isPrimaryKey\",\n /**\n * Marks a field as a stable, declaration-side **business key** —\n * an identity independent from the random `_id` (`isPrimaryKey`).\n *\n * Used by data seeding to safely upsert, upgrade and synchronize seeded rows.\n * Unlike `isPrimaryKey`,\n * a business key is mutable by users (renames are handled by a per-seed\n * `renames: [{ from, to }]` migrator), and it carries no implicit\n * decorators (`isPrimaryKey` is composite — `isBusinessKey` is purely\n * a marker so it can co-exist with whatever editing semantics the field\n * already has).\n *\n * Composite scope-aware identity uses the object-level\n * `OBJECT_BUSINESS_KEY_SET` decorator on the schema root.\n */\n IS_BUSINESS_KEY = \"isBusinessKey\",\n /**\n * Object-level decorator declaring a **composite business key** for the\n * schema (e.g. `(organizationId, templateKey)`). Schema-level analog of\n * `IS_BUSINESS_KEY`. Used by the data-seeding subsystem.\n *\n * Field-level `IS_BUSINESS_KEY` and object-level `OBJECT_BUSINESS_KEY_SET`\n * are **mutually exclusive** on the same schema — pick one identity model\n * (single field vs composite). Mixing is rejected at decoration time.\n */\n OBJECT_BUSINESS_KEY_SET = \"businessKeySet\",\n TTL = \"ttl\",\n // String edit mode convenience decorators (shorthand for STRING_UI with specific editMode)\n IS_PASSWORD = \"isPassword\",\n IS_OTP = \"isOtp\",\n IS_COLOR = \"isColor\",\n // Form validation decorators\n IS_DRAFT_RELAXED = \"isDraftRelaxed\",\n // FIX-P5-H1: Conditional visibility decorator\n SHOW_WHEN = \"showWhen\",\n // System enum decorator - marks an enum field as using a system-level enum (currency, language, country, etc.)\n SYSTEM_ENUM = \"systemEnum\",\n // Ephemeral field decorator - marks a field as transient response-only data (shown once, then gone)\n IS_EPHEMERAL = \"isEphemeral\",\n // CRDT field decorator — marks a field for future field-level LWW merge.\n IS_CRDT = \"isCRDT\",\n // Unified {primitive}UI decorators — new API replacing display policy + formField decomposition\n BOOLEAN_UI = \"booleanUI\",\n STRING_UI = \"stringUI\",\n NUMBER_UI = \"numberUI\",\n ENUM_UI = \"enumUI\",\n DATE_UI = \"dateUI\",\n DATETIME_UI = \"dateTimeUI\",\n TIME_UI = \"timeUI\",\n MONEY_UI = \"moneyUI\",\n CODE_UI = \"codeUI\",\n FILE_UI = \"fileUI\",\n DURATION_UI = \"durationUI\",\n PHONE_UI = \"phoneUI\",\n BIGDECIMAL_UI = \"bigDecimalUI\",\n FOREIGN_KEY_UI = \"foreignKeyUI\",\n ARRAY_UI = \"arrayUI\",\n OBJECT_UI = \"objectUI\",\n // Per-primitive field specification decorators — business semantics (companion-only)\n STRING_SPEC = \"stringSpec\",\n NUMBER_SPEC = \"numberSpec\",\n BOOLEAN_SPEC = \"booleanSpec\",\n DATE_SPEC = \"dateSpec\",\n DATETIME_SPEC = \"dateTimeSpec\",\n TIME_SPEC = \"timeSpec\",\n ENUM_SPEC = \"enumSpec\",\n MONEY_SPEC = \"moneySpec\",\n CODE_SPEC = \"codeSpec\",\n FILE_SPEC = \"fileSpec\",\n DURATION_SPEC = \"durationSpec\",\n PHONE_SPEC = \"phoneSpec\",\n BIGDECIMAL_SPEC = \"bigDecimalSpec\",\n FOREIGN_KEY_SPEC = \"foreignKeySpec\",\n ARRAY_SPEC = \"arraySpec\",\n OBJECT_SPEC = \"objectSpec\",\n}\n\n// Custom field metadata stored on Zod schemas via decorators.\n// It represents all possible metadata that can be attached to a schema.\n// NOTE: The main CustomFieldMetadata interface is defined after ZodDecorator_Types\n// to properly reference the types from ZodDecorator_Types.\n\nexport type ZodDecorator_ParamsType = {\n [ZodDecorator.IS_DB_INDEXED]: undefined;\n [ZodDecorator.IS_FOREIGN_KEY]: ForeignKeyStructuralParams | DecoratorUpdater<ForeignKeyStructuralParams> | undefined;\n [ZodDecorator.IS_HIDDEN]: HiddenFieldParams | DecoratorUpdater<HiddenFieldParams> | undefined;\n [ZodDecorator.IS_NOT_EDITABLE]: NotEditableFieldParams | DecoratorUpdater<NotEditableFieldParams> | undefined;\n // New decorators for resource derived objects rationalization\n [ZodDecorator.IS_SUMMARY_FIELD]: SummaryFieldParams | DecoratorUpdater<SummaryFieldParams> | undefined;\n [ZodDecorator.IS_BACKEND_ONLY]: BackendOnlyFieldParams | DecoratorUpdater<BackendOnlyFieldParams> | undefined;\n [ZodDecorator.IS_WRITE_ONLY_SECRET]: WriteOnlySecretFieldParams | DecoratorUpdater<WriteOnlySecretFieldParams> | undefined;\n /**\n * The field's impersonalization treatment. Accepts BOTH authored forms — a bare `RedactionType`\n * value (the common case) or the full {@link ImpersonalizeFieldParams} object when a `MASK` needs\n * a field-specific `maskValue`. The decorator chokepoint normalizes either to the params object.\n * The treatment is typed as a plain string at this layer (zod-decorators sits below saas-models\n * and cannot import `RedactionType`).\n */\n [ZodDecorator.IMPERSONALIZE_WITH]: string | ImpersonalizeFieldParams;\n /**\n * The field's portability provenance — a `DataPortabilityProvenance` value, typed as a plain\n * string at this layer (zod-decorators sits below saas-models and cannot import the enum). One\n * datum, so unlike {@link ZodDecorator.IMPERSONALIZE_WITH} there is no object authoring form to\n * normalize; if a second axis is ever needed the chokepoint widens exactly as that one did.\n */\n [ZodDecorator.PORTABILITY_PROVENANCE]: string;\n /**\n * The field's personal-data categories — `PersonalDataCategory` values, typed as plain strings at\n * this layer (zod-decorators sits below saas-models and cannot import the enum). Accepts a single\n * value (the common case) or an array; the chokepoint normalizes either to a deduped array.\n */\n [ZodDecorator.DATA_CATEGORIES]: string | readonly string[];\n // Audit-evidence marker — parameterless, like IS_BUSINESS_KEY. A field either is evidence or is\n // not; there is no axis to parameterize, and adding one would invite per-field redaction policy\n // to grow here instead of on the impersonalization decorator that owns it.\n [ZodDecorator.IS_AUDIT_EVIDENCE]: undefined;\n /**\n * RAG-source declaration. The config object is optional — `.ragSource()` with no argument is a\n * complete declaration — and the chokepoint normalizes an omitted config to `{}` so every reader\n * sees one stored shape (see {@link ZodDecorator_Types}).\n */\n [ZodDecorator.RAG_SOURCE]: RagSourceConfiguration | undefined;\n [ZodDecorator.IS_VIRTUAL]: VirtualFieldParams | DecoratorUpdater<VirtualFieldParams>;\n [ZodDecorator.IS_DISCRIMINATOR]: DiscriminatorFieldParams | DecoratorUpdater<DiscriminatorFieldParams> | undefined;\n [ZodDecorator.EXCLUDE_FROM_CREATE]: undefined;\n [ZodDecorator.EXCLUDE_FROM_UPDATE]: undefined;\n // Database constraint decorators\n [ZodDecorator.IS_UNIQUE]: UniqueFieldParams | DecoratorUpdater<UniqueFieldParams> | undefined;\n [ZodDecorator.IS_PRIMARY_KEY]: undefined;\n // Business key marker (parameterless field-level marker for the data-seeding subsystem)\n [ZodDecorator.IS_BUSINESS_KEY]: undefined;\n // Composite business key (object-level decorator carrying the ordered list of field names)\n [ZodDecorator.OBJECT_BUSINESS_KEY_SET]: BusinessKeySetParams | DecoratorUpdater<BusinessKeySetParams>;\n [ZodDecorator.TTL]: TtlFieldParams | DecoratorUpdater<TtlFieldParams>;\n // String edit mode convenience decorators\n [ZodDecorator.IS_PASSWORD]: undefined;\n [ZodDecorator.IS_OTP]: OtpFieldParams | DecoratorUpdater<OtpFieldParams> | undefined;\n [ZodDecorator.IS_COLOR]: undefined;\n // Form validation decorators\n [ZodDecorator.IS_DRAFT_RELAXED]: undefined;\n // FIX-P5-H1: Conditional visibility decorator\n [ZodDecorator.SHOW_WHEN]: ShowWhenParams | DecoratorUpdater<ShowWhenParams>;\n // System enum decorator — the param is the system enum name string (e.g. 'AvailableCurrency')\n [ZodDecorator.SYSTEM_ENUM]: string;\n // Ephemeral field decorator — marks response-only transient data (API keys, tokens, etc.)\n [ZodDecorator.IS_EPHEMERAL]: undefined;\n // CRDT field decorator — boolean marker, no parameters\n [ZodDecorator.IS_CRDT]: undefined;\n // Unified {primitive}UI decorators — all accept their respective UIParams or a DecoratorUpdater\n [ZodDecorator.BOOLEAN_UI]: BooleanUIParams | DecoratorUpdater<BooleanUIParams> | undefined;\n [ZodDecorator.STRING_UI]: StringUIParams | DecoratorUpdater<StringUIParams> | undefined;\n [ZodDecorator.NUMBER_UI]: NumberUIParams | DecoratorUpdater<NumberUIParams> | undefined;\n [ZodDecorator.ENUM_UI]: EnumUIParams | DecoratorUpdater<EnumUIParams> | undefined;\n [ZodDecorator.DATE_UI]: DateUIParams | DecoratorUpdater<DateUIParams> | undefined;\n [ZodDecorator.DATETIME_UI]: DateTimeUIParams | DecoratorUpdater<DateTimeUIParams> | undefined;\n [ZodDecorator.TIME_UI]: TimeUIParams | DecoratorUpdater<TimeUIParams> | undefined;\n [ZodDecorator.MONEY_UI]: MoneyUIParams | DecoratorUpdater<MoneyUIParams> | undefined;\n [ZodDecorator.CODE_UI]: CodeUIParams | DecoratorUpdater<CodeUIParams> | undefined;\n [ZodDecorator.FILE_UI]: FileUIParams | DecoratorUpdater<FileUIParams> | undefined;\n [ZodDecorator.DURATION_UI]: DurationUIParams | DecoratorUpdater<DurationUIParams> | undefined;\n [ZodDecorator.PHONE_UI]: PhoneUIParams | DecoratorUpdater<PhoneUIParams> | undefined;\n [ZodDecorator.BIGDECIMAL_UI]: BigDecimalUIParams | DecoratorUpdater<BigDecimalUIParams> | undefined;\n [ZodDecorator.FOREIGN_KEY_UI]: ForeignKeyUIParams | DecoratorUpdater<ForeignKeyUIParams> | undefined;\n [ZodDecorator.ARRAY_UI]: ArrayUIParams | DecoratorUpdater<ArrayUIParams> | undefined;\n [ZodDecorator.OBJECT_UI]: ObjectUIParams | DecoratorUpdater<ObjectUIParams> | undefined;\n // Per-primitive field specification decorators\n [ZodDecorator.STRING_SPEC]: StringSpecParams | DecoratorUpdater<StringSpecParams> | undefined;\n [ZodDecorator.NUMBER_SPEC]: NumberSpecParams | DecoratorUpdater<NumberSpecParams> | undefined;\n [ZodDecorator.BOOLEAN_SPEC]: BooleanSpecParams | DecoratorUpdater<BooleanSpecParams> | undefined;\n [ZodDecorator.DATE_SPEC]: DateSpecParams | DecoratorUpdater<DateSpecParams> | undefined;\n [ZodDecorator.DATETIME_SPEC]: DateTimeSpecParams | DecoratorUpdater<DateTimeSpecParams> | undefined;\n [ZodDecorator.TIME_SPEC]: TimeSpecParams | DecoratorUpdater<TimeSpecParams> | undefined;\n [ZodDecorator.ENUM_SPEC]: EnumSpecParams | DecoratorUpdater<EnumSpecParams> | undefined;\n [ZodDecorator.MONEY_SPEC]: MoneySpecParams | DecoratorUpdater<MoneySpecParams> | undefined;\n [ZodDecorator.CODE_SPEC]: CodeSpecParams | DecoratorUpdater<CodeSpecParams> | undefined;\n [ZodDecorator.FILE_SPEC]: FileSpecParams | DecoratorUpdater<FileSpecParams> | undefined;\n [ZodDecorator.DURATION_SPEC]: DurationSpecParams | DecoratorUpdater<DurationSpecParams> | undefined;\n [ZodDecorator.PHONE_SPEC]: PhoneSpecParams | DecoratorUpdater<PhoneSpecParams> | undefined;\n [ZodDecorator.BIGDECIMAL_SPEC]: BigDecimalSpecParams | DecoratorUpdater<BigDecimalSpecParams> | undefined;\n [ZodDecorator.FOREIGN_KEY_SPEC]: ForeignKeySpecParams | DecoratorUpdater<ForeignKeySpecParams> | undefined;\n [ZodDecorator.ARRAY_SPEC]: ArraySpecParams | DecoratorUpdater<ArraySpecParams> | undefined;\n [ZodDecorator.OBJECT_SPEC]: ObjectSpecParams | DecoratorUpdater<ObjectSpecParams> | undefined;\n}\n\n\n\nexport type ZodDecorator_Types = {\n [ZodDecorator.IS_DB_INDEXED]: boolean;\n [ZodDecorator.IS_FOREIGN_KEY]: ForeignKeyStructuralParams | true;\n [ZodDecorator.IS_HIDDEN]: HiddenFieldParams | true;\n [ZodDecorator.IS_NOT_EDITABLE]: NotEditableFieldParams | true;\n // New decorators for resource derived objects rationalization\n [ZodDecorator.IS_SUMMARY_FIELD]: SummaryFieldParams | true;\n [ZodDecorator.IS_BACKEND_ONLY]: BackendOnlyFieldParams | true;\n [ZodDecorator.IS_WRITE_ONLY_SECRET]: WriteOnlySecretFieldParams | true;\n /** Impersonalization scrub params — the treatment (a `RedactionType` value carried as an opaque\n * `string`, since zod-decorators sits below saas-models) plus an optional `MASK` override value.\n * ALWAYS the normalized object: the chokepoint widens a bare-string authoring form on the way in,\n * so every reader sees one shape. */\n [ZodDecorator.IMPERSONALIZE_WITH]: ImpersonalizeFieldParams;\n /** Portability provenance — a `DataPortabilityProvenance` value carried as an opaque `string`\n * (zod-decorators sits below saas-models). Stored exactly as authored; the chokepoint only\n * rejects blanks. */\n [ZodDecorator.PORTABILITY_PROVENANCE]: string;\n /** Personal-data categories — `PersonalDataCategory` values carried as opaque `string`s\n * (zod-decorators sits below saas-models). ALWAYS the normalized array, deduped and non-empty:\n * the chokepoint widens a bare single-value authoring form on the way in, so every reader sees\n * one shape and `getDataCategories` can answer \"is this field categorized?\" by presence alone. */\n [ZodDecorator.DATA_CATEGORIES]: readonly string[];\n /** Audit-evidence marker — stored as the bare `true` sentinel (parameterless, like IS_BUSINESS_KEY). */\n [ZodDecorator.IS_AUDIT_EVIDENCE]: true;\n /** RAG-source config — ALWAYS the normalized object ( `{}` when authored with no argument): the\n * chokepoint validates and normalizes on the way in, so every reader sees one shape and\n * `getRagSourceConfig` can answer \"is this field a source?\" by presence alone. */\n [ZodDecorator.RAG_SOURCE]: RagSourceConfiguration;\n [ZodDecorator.IS_VIRTUAL]: VirtualFieldParams;\n [ZodDecorator.IS_DISCRIMINATOR]: DiscriminatorFieldParams | true;\n [ZodDecorator.EXCLUDE_FROM_CREATE]: true;\n [ZodDecorator.EXCLUDE_FROM_UPDATE]: true;\n // Database constraint decorators\n [ZodDecorator.IS_UNIQUE]: UniqueFieldParams | true;\n [ZodDecorator.IS_PRIMARY_KEY]: true;\n // Business key marker (parameterless field-level marker for the data-seeding subsystem)\n [ZodDecorator.IS_BUSINESS_KEY]: true;\n // Composite business key (object-level — stored params shape after resolver unwraps DecoratorUpdater)\n [ZodDecorator.OBJECT_BUSINESS_KEY_SET]: BusinessKeySetParams;\n [ZodDecorator.TTL]: TtlFieldParams;\n // String edit mode convenience decorators\n [ZodDecorator.IS_PASSWORD]: true;\n [ZodDecorator.IS_OTP]: OtpFieldParams | true;\n [ZodDecorator.IS_COLOR]: true;\n // Form validation decorators\n [ZodDecorator.IS_DRAFT_RELAXED]: true;\n // FIX-P5-H1: Conditional visibility decorator\n [ZodDecorator.SHOW_WHEN]: ShowWhenParams;\n // System enum decorator\n [ZodDecorator.SYSTEM_ENUM]: string;\n // Ephemeral field decorator\n [ZodDecorator.IS_EPHEMERAL]: true;\n // CRDT field decorator\n [ZodDecorator.IS_CRDT]: true;\n // Unified {primitive}UI decorators — stored types (after resolver unwraps DecoratorUpdater)\n [ZodDecorator.BOOLEAN_UI]: BooleanUIParams;\n [ZodDecorator.STRING_UI]: StringUIParams;\n [ZodDecorator.NUMBER_UI]: NumberUIParams;\n [ZodDecorator.ENUM_UI]: EnumUIParams;\n [ZodDecorator.DATE_UI]: DateUIParams;\n [ZodDecorator.DATETIME_UI]: DateTimeUIParams;\n [ZodDecorator.TIME_UI]: TimeUIParams;\n [ZodDecorator.MONEY_UI]: MoneyUIParams;\n [ZodDecorator.CODE_UI]: CodeUIParams;\n [ZodDecorator.FILE_UI]: FileUIParams;\n [ZodDecorator.DURATION_UI]: DurationUIParams;\n [ZodDecorator.PHONE_UI]: PhoneUIParams;\n [ZodDecorator.BIGDECIMAL_UI]: BigDecimalUIParams;\n [ZodDecorator.FOREIGN_KEY_UI]: ForeignKeyUIParams;\n [ZodDecorator.ARRAY_UI]: ArrayUIParams;\n [ZodDecorator.OBJECT_UI]: ObjectUIParams;\n // Per-primitive field specification decorators\n [ZodDecorator.STRING_SPEC]: StringSpecParams;\n [ZodDecorator.NUMBER_SPEC]: NumberSpecParams;\n [ZodDecorator.BOOLEAN_SPEC]: BooleanSpecParams;\n [ZodDecorator.DATE_SPEC]: DateSpecParams;\n [ZodDecorator.DATETIME_SPEC]: DateTimeSpecParams;\n [ZodDecorator.TIME_SPEC]: TimeSpecParams;\n [ZodDecorator.ENUM_SPEC]: EnumSpecParams;\n [ZodDecorator.MONEY_SPEC]: MoneySpecParams;\n [ZodDecorator.CODE_SPEC]: CodeSpecParams;\n [ZodDecorator.FILE_SPEC]: FileSpecParams;\n [ZodDecorator.DURATION_SPEC]: DurationSpecParams;\n [ZodDecorator.PHONE_SPEC]: PhoneSpecParams;\n [ZodDecorator.BIGDECIMAL_SPEC]: BigDecimalSpecParams;\n [ZodDecorator.FOREIGN_KEY_SPEC]: ForeignKeySpecParams;\n [ZodDecorator.ARRAY_SPEC]: ArraySpecParams;\n [ZodDecorator.OBJECT_SPEC]: ObjectSpecParams;\n}\n/** @wildo_source:part:end zod.decorators.decorator-vocabulary */\n\n/**\n * @wildo_source:part:start zod.decorators.schema-metadata\n *\n * Per-field decorator metadata bag stored on schema instances under `SCHEMA_METADATA`.\n */\nexport interface CustomFieldMetadata {\n [ZodDecorator.IS_DB_INDEXED]?: ZodDecorator_Types[ZodDecorator.IS_DB_INDEXED];\n [ZodDecorator.IS_FOREIGN_KEY]?: ZodDecorator_Types[ZodDecorator.IS_FOREIGN_KEY];\n [ZodDecorator.IS_HIDDEN]?: ZodDecorator_Types[ZodDecorator.IS_HIDDEN];\n [ZodDecorator.IS_NOT_EDITABLE]?: ZodDecorator_Types[ZodDecorator.IS_NOT_EDITABLE];\n // New decorators for resource derived objects rationalization\n [ZodDecorator.IS_SUMMARY_FIELD]?: ZodDecorator_Types[ZodDecorator.IS_SUMMARY_FIELD];\n [ZodDecorator.IS_BACKEND_ONLY]?: ZodDecorator_Types[ZodDecorator.IS_BACKEND_ONLY];\n [ZodDecorator.IS_WRITE_ONLY_SECRET]?: ZodDecorator_Types[ZodDecorator.IS_WRITE_ONLY_SECRET];\n [ZodDecorator.IMPERSONALIZE_WITH]?: ZodDecorator_Types[ZodDecorator.IMPERSONALIZE_WITH];\n [ZodDecorator.PORTABILITY_PROVENANCE]?: ZodDecorator_Types[ZodDecorator.PORTABILITY_PROVENANCE];\n [ZodDecorator.DATA_CATEGORIES]?: ZodDecorator_Types[ZodDecorator.DATA_CATEGORIES];\n [ZodDecorator.IS_AUDIT_EVIDENCE]?: ZodDecorator_Types[ZodDecorator.IS_AUDIT_EVIDENCE];\n [ZodDecorator.RAG_SOURCE]?: ZodDecorator_Types[ZodDecorator.RAG_SOURCE];\n [ZodDecorator.IS_VIRTUAL]?: ZodDecorator_Types[ZodDecorator.IS_VIRTUAL];\n [ZodDecorator.IS_DISCRIMINATOR]?: ZodDecorator_Types[ZodDecorator.IS_DISCRIMINATOR];\n [ZodDecorator.EXCLUDE_FROM_CREATE]?: ZodDecorator_Types[ZodDecorator.EXCLUDE_FROM_CREATE];\n [ZodDecorator.EXCLUDE_FROM_UPDATE]?: ZodDecorator_Types[ZodDecorator.EXCLUDE_FROM_UPDATE];\n // Database constraint decorators\n [ZodDecorator.IS_UNIQUE]?: ZodDecorator_Types[ZodDecorator.IS_UNIQUE];\n [ZodDecorator.IS_PRIMARY_KEY]?: ZodDecorator_Types[ZodDecorator.IS_PRIMARY_KEY];\n [ZodDecorator.IS_BUSINESS_KEY]?: ZodDecorator_Types[ZodDecorator.IS_BUSINESS_KEY];\n [ZodDecorator.OBJECT_BUSINESS_KEY_SET]?: ZodDecorator_Types[ZodDecorator.OBJECT_BUSINESS_KEY_SET];\n [ZodDecorator.TTL]?: ZodDecorator_Types[ZodDecorator.TTL];\n // String edit mode convenience decorators\n [ZodDecorator.IS_PASSWORD]?: ZodDecorator_Types[ZodDecorator.IS_PASSWORD];\n [ZodDecorator.IS_OTP]?: ZodDecorator_Types[ZodDecorator.IS_OTP];\n [ZodDecorator.IS_COLOR]?: ZodDecorator_Types[ZodDecorator.IS_COLOR];\n // Form validation decorators\n [ZodDecorator.IS_DRAFT_RELAXED]?: ZodDecorator_Types[ZodDecorator.IS_DRAFT_RELAXED];\n // FIX-P5-H1: Conditional visibility decorator\n [ZodDecorator.SHOW_WHEN]?: ZodDecorator_Types[ZodDecorator.SHOW_WHEN];\n // System enum decorator\n [ZodDecorator.SYSTEM_ENUM]?: ZodDecorator_Types[ZodDecorator.SYSTEM_ENUM];\n // Ephemeral field decorator\n [ZodDecorator.IS_EPHEMERAL]?: ZodDecorator_Types[ZodDecorator.IS_EPHEMERAL];\n // CRDT field decorator\n [ZodDecorator.IS_CRDT]?: ZodDecorator_Types[ZodDecorator.IS_CRDT];\n // Unified {primitive}UI decorators\n [ZodDecorator.BOOLEAN_UI]?: ZodDecorator_Types[ZodDecorator.BOOLEAN_UI];\n [ZodDecorator.STRING_UI]?: ZodDecorator_Types[ZodDecorator.STRING_UI];\n [ZodDecorator.NUMBER_UI]?: ZodDecorator_Types[ZodDecorator.NUMBER_UI];\n [ZodDecorator.ENUM_UI]?: ZodDecorator_Types[ZodDecorator.ENUM_UI];\n [ZodDecorator.DATE_UI]?: ZodDecorator_Types[ZodDecorator.DATE_UI];\n [ZodDecorator.DATETIME_UI]?: ZodDecorator_Types[ZodDecorator.DATETIME_UI];\n [ZodDecorator.TIME_UI]?: ZodDecorator_Types[ZodDecorator.TIME_UI];\n [ZodDecorator.MONEY_UI]?: ZodDecorator_Types[ZodDecorator.MONEY_UI];\n [ZodDecorator.CODE_UI]?: ZodDecorator_Types[ZodDecorator.CODE_UI];\n [ZodDecorator.FILE_UI]?: ZodDecorator_Types[ZodDecorator.FILE_UI];\n [ZodDecorator.DURATION_UI]?: ZodDecorator_Types[ZodDecorator.DURATION_UI];\n [ZodDecorator.PHONE_UI]?: ZodDecorator_Types[ZodDecorator.PHONE_UI];\n [ZodDecorator.BIGDECIMAL_UI]?: ZodDecorator_Types[ZodDecorator.BIGDECIMAL_UI];\n [ZodDecorator.FOREIGN_KEY_UI]?: ZodDecorator_Types[ZodDecorator.FOREIGN_KEY_UI];\n [ZodDecorator.ARRAY_UI]?: ZodDecorator_Types[ZodDecorator.ARRAY_UI];\n [ZodDecorator.OBJECT_UI]?: ZodDecorator_Types[ZodDecorator.OBJECT_UI];\n // Per-primitive field specification decorators\n [ZodDecorator.STRING_SPEC]?: ZodDecorator_Types[ZodDecorator.STRING_SPEC];\n [ZodDecorator.NUMBER_SPEC]?: ZodDecorator_Types[ZodDecorator.NUMBER_SPEC];\n [ZodDecorator.BOOLEAN_SPEC]?: ZodDecorator_Types[ZodDecorator.BOOLEAN_SPEC];\n [ZodDecorator.DATE_SPEC]?: ZodDecorator_Types[ZodDecorator.DATE_SPEC];\n [ZodDecorator.DATETIME_SPEC]?: ZodDecorator_Types[ZodDecorator.DATETIME_SPEC];\n [ZodDecorator.TIME_SPEC]?: ZodDecorator_Types[ZodDecorator.TIME_SPEC];\n [ZodDecorator.ENUM_SPEC]?: ZodDecorator_Types[ZodDecorator.ENUM_SPEC];\n [ZodDecorator.MONEY_SPEC]?: ZodDecorator_Types[ZodDecorator.MONEY_SPEC];\n [ZodDecorator.CODE_SPEC]?: ZodDecorator_Types[ZodDecorator.CODE_SPEC];\n [ZodDecorator.FILE_SPEC]?: ZodDecorator_Types[ZodDecorator.FILE_SPEC];\n [ZodDecorator.DURATION_SPEC]?: ZodDecorator_Types[ZodDecorator.DURATION_SPEC];\n [ZodDecorator.PHONE_SPEC]?: ZodDecorator_Types[ZodDecorator.PHONE_SPEC];\n [ZodDecorator.BIGDECIMAL_SPEC]?: ZodDecorator_Types[ZodDecorator.BIGDECIMAL_SPEC];\n [ZodDecorator.FOREIGN_KEY_SPEC]?: ZodDecorator_Types[ZodDecorator.FOREIGN_KEY_SPEC];\n [ZodDecorator.ARRAY_SPEC]?: ZodDecorator_Types[ZodDecorator.ARRAY_SPEC];\n [ZodDecorator.OBJECT_SPEC]?: ZodDecorator_Types[ZodDecorator.OBJECT_SPEC];\n /** Range schema type (only present for range schemas) */\n rangeType?: RangeType;\n /** Full range schema configuration (only present for range schemas) */\n rangeConfig?: RangeSchemaMetadata;\n /** Currency schema configuration (only present for currency schemas) */\n moneyConfig?: MoneySchemaMetadata;\n /** BigDecimal schema configuration (only present for bigdecimal schemas) */\n bigDecimalConfig?: BigDecimalSchemaMetadata;\n /** Duration schema configuration (only present for duration schemas) */\n durationConfig?: DurationSchemaMetadata;\n /** Phone schema configuration (only present for phone schemas) */\n phoneConfig?: PhoneSchemaMetadata;\n /** Code schema configuration (only present for code schemas) */\n codeConfig?: CodeSchemaMetadata;\n /** File schema configuration (only present for file schemas) */\n fileConfig?: FileSchemaMetadata;\n /** Versioned schema configuration (only present for versioned schemas) */\n versionedConfig?: VersionedSchemaMetadata;\n /** Versioned foreign key configuration (only present for versioned foreign key schemas) */\n versionedForeignKeyConfig?: VersionedForeignKeySchemaMetadata;\n}\n/** @wildo_source:part:end zod.decorators.schema-metadata */\n\n\n\n\n//================================================\n// ZOD TYPE COMPATIBILITY\n//================================================\n// Get types from instances for Zod v4 compatibility\ntype ZodenumInstance = ReturnType<typeof z.enum>;\n\nexport type PrimitiveZodType =\n | z.ZodString\n | z.ZodNumber\n | z.ZodBoolean\n | z.ZodDate\n | z.ZodEnum<any>\n | ZodenumInstance\n | ZodBrandedColorInstance\n | DecoratedPrimitiveZodType<z.ZodString>\n | DecoratedPrimitiveZodType<z.ZodNumber>\n | DecoratedPrimitiveZodType<z.ZodBoolean>\n | DecoratedPrimitiveZodType<z.ZodDate>\n | DecoratedPrimitiveZodType<z.ZodEnum<any>>\n | DecoratedPrimitiveZodType<ZodenumInstance>;\n\n\n //------------------------------------------------\n // SERIALIZATION\n //------------------------------------------------\n\n export type SerializableZodSchema =\n | { type: 'string'; optional?: boolean; nullable?: boolean; description?: string; metadata?: CustomFieldMetadata }\n | { type: 'number'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'bigint'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'boolean'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'date'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'unknown' | 'any'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'literal'; value: unknown; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'enum'; values: string[]; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'enum'; values: string[]; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'array'; element: SerializableZodSchema; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'set'; element: SerializableZodSchema; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'tuple'; items: SerializableZodSchema[]; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'record'; key: SerializableZodSchema; value: SerializableZodSchema; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'union'; options: SerializableZodSchema[]; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'object'; properties: Record<string, SerializableZodSchema>; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'lazy'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata };\n\n"]}
|
|
1
|
+
{"version":3,"file":"zod-decorators.types.js","sourceRoot":"","sources":["../../../src/zod-decorators.types.ts"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAW,MAAM,CAAC,GAAG,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CAAA;IACtB,kCAAkB,CAAA;IAClB,kCAAkB,CAAA;IAClB,0CAA0B,CAAA;IAC1B,kCAAkB,CAAA;IAClB,oCAAoB,CAAA;IACpB,kCAAkB,CAAA;IAClB,kCAAkB,CAAA;IAClB,0CAA0B,CAAA;IAC1B,oCAAoB,CAAA;IACpB,8CAA8B,CAAA;IAC9B,+CAA+B,CAAA;IAC/B,oCAAoB,CAAA;IACpB,sCAAsB,CAAA;IACtB,qFAAqF;IACrF,0CAA0B,CAAA;IAC1B,0CAA0B,CAAA;IAC1B,4CAA4B,CAAA;IAC5B,sCAAsB,CAAA;IACtB,8CAA8B,CAAA;IAC9B,sCAAsB,CAAA;IACtB,sCAAsB,CAAA;IACtB,wCAAwB,CAAA;IACxB,sCAAsB,CAAA;IACtB,sCAAsB,CAAA;IACtB,8CAA8B,CAAA;IAC9B,wCAAwB,CAAA;IACxB,kDAAkC,CAAA;IAClC,mDAAmC,CAAA;IACnC,wCAAwB,CAAA;IACxB,0CAA0B,CAAA;AAC5B,CAAC,EA9NW,YAAY,KAAZ,YAAY,QA8NvB","sourcesContent":["import type { ComponentType } from 'react';\nimport type { CountryCode as LibPhoneNumberCountryCode } from 'libphonenumber-js';\nimport { Breakpoint, ViewportBreakpoint } from './commons';\nimport { AvailableCurrency, CurrencyAllowed } from './currencies.shared.schemas';\nimport { z } from 'zod';\nimport { DecoratedPrimitiveZodType } from './zod.module-override';\nimport { ZodBrandedColorInstance, ZodTypeForColors } from './zod-color';\n\n\n/**\n * @wildo_source:part:start zod.decorators.schema-metadata\n *\n * Internal metadata key used by Wildo's schema decorators.\n *\n * Application schemas obtain this metadata by using the supported decorators\n * and schema factories from `@wildo-ai/zod-decorators`; application code must\n * not write this symbol directly. `Symbol.for()` keeps independently loaded\n * package copies interoperable while the framework reads the schema contract.\n */\nexport const SCHEMA_METADATA: symbol = Symbol.for('schema_metadata');\n/** @wildo_source:part:end zod.decorators.schema-metadata */\n\n\n\n// Schema type categories for component selection.\n// Represents the underlying Zod schema type detected from introspection.\n\nexport enum FieldSchemaType {\n STRING = 'string', // String schemas (z.string)\n NUMBER = 'number', // Number schemas (z.number, z.int)\n BIGINT = 'bigint', // BigInt schemas (z.bigint)\n BOOLEAN = 'boolean', // Boolean schemas (z.boolean)\n ENUM = 'enum', // Enum schemas (z.enum, z.enum)\n DATE = 'date', // Date schemas (z.date)\n OBJECT = 'object', // Object schemas (z.object) - NOT range schemas\n ARRAY = 'array', // Array schemas (z.array)\n SET = 'set', // Set schemas (z.set) - stored as array\n TUPLE = 'tuple', // Tuple schemas (z.tuple)\n RECORD = 'record', // Record schemas (z.record)\n MAP = 'map', // Map schemas (z.map)\n TIME = 'time', // Time schemas (z.time)\n DATETIME = 'datetime', // Datetime schemas (z.datetime)\n RANGE_NUMBER = 'range_number', // Range number schemas created by z_range('number')\n RANGE_DATE = 'range_date', // Range date schemas created by z_range('date')\n RANGE_DATETIME = 'range_datetime', // Range datetime schemas created by z_range('datetime')\n RANGE_TIME = 'range_time', // Range time schemas created by z_range('time')\n RANGE_BIGDECIMAL = 'range_bigdecimal', // Range bigdecimal schemas created by z_range('bigdecimal')\n RANGE_MONEY = 'range_money', // Range money schemas created by z_range('money')\n MONEY = 'money', // Money schemas created by z_money() - detected by SCHEMA_METADATA.moneyConfig\n BIGDECIMAL = 'bigdecimal', // BigDecimal schemas created by z_bigdecimal() - detected by SCHEMA_METADATA.bigDecimalConfig\n CODE = 'code', // Code schemas created by z_code() - detected by SCHEMA_METADATA.codeConfig\n FILE = 'file', // File schemas created by z_file() - detected by SCHEMA_METADATA.fileConfig\n DURATION = 'duration', // Duration schemas created by z_duration() - detected by SCHEMA_METADATA.durationConfig\n PHONE = 'phone', // Phone schemas created by z_phone() - detected by SCHEMA_METADATA.phoneConfig\n VERSIONED_FOREIGN_KEY = 'versioned_foreign_key', // Versioned foreign key schemas created by z_foreignKeyVersioned() - detected by SCHEMA_METADATA.versionedForeignKeyConfig\n VERSIONED_OBJECT = 'versioned_object', // Versioned object schemas created by versioned() - detected by SCHEMA_METADATA.versionedConfig\n UNKNOWN = 'unknown', // Unknown or unsupported schema type\n}\n\n///=======================================================================================================================\n/// FORM FIELD COMPONENT TYPES\n///=======================================================================================================================\n\n// Form field component types.\n// Represents the UI component that should render a form field.\nexport enum FormFieldComponent {\n INPUT = 'input', // Standard text input\n TEXTAREA = 'textarea', // Multi-line text area\n SELECT = 'select', // Dropdown select\n RADIO_GROUP = 'radio-group', // Radio button group\n CHECKBOX = 'checkbox', // Single checkbox\n CHECKBOX_GROUP = 'checkbox-group', // Checkbox group for multi-select (arrays of enums)\n SWITCH = 'switch', // Toggle switch\n SLIDER = 'slider', // Single value slider\n DATE = 'date', // Date picker (single date)\n TIME = 'time', // Time picker (single time)\n DATETIME = 'datetime', // DateTime picker (date + time)\n RANGE_SLIDER = 'range-slider', // Number range slider (two thumbs for min/max)\n DATE_RANGE = 'date-range', // Date range picker (from/to dates)\n DATETIME_RANGE = 'datetime-range', // DateTime range picker (from/to datetime)\n TIME_RANGE = 'time-range', // Time range picker (from/to time)\n BIGDECIMAL_RANGE = 'bigdecimal-range', // BigDecimal range input (from/to bigdecimal)\n MONEY_RANGE = 'money-range', // Money range input (from/to money)\n DURATION = 'duration', // Duration input (value + unit selector)\n PHONE = 'phone', // Phone input (country + number, E.164 output)\n}\n\n// ================================\n// HTML AUTOCOMPLETE TOKENS\n// ================================\n\n/**\n * Official HTML autocomplete field identifiers.\n * Excludes `section-*`, `on`, and `off` because the decorator contract here is\n * focused on typed semantic field tokens rather than raw form-level switches.\n */\nexport enum AutocompleteFieldIdentifier {\n NAME = 'name',\n HONORIFIC_PREFIX = 'honorific-prefix',\n GIVEN_NAME = 'given-name',\n ADDITIONAL_NAME = 'additional-name',\n FAMILY_NAME = 'family-name',\n HONORIFIC_SUFFIX = 'honorific-suffix',\n NICKNAME = 'nickname',\n USERNAME = 'username',\n NEW_PASSWORD = 'new-password',\n CURRENT_PASSWORD = 'current-password',\n ONE_TIME_CODE = 'one-time-code',\n ORGANIZATION_TITLE = 'organization-title',\n ORGANIZATION = 'organization',\n STREET_ADDRESS = 'street-address',\n ADDRESS_LINE_1 = 'address-line1',\n ADDRESS_LINE_2 = 'address-line2',\n ADDRESS_LINE_3 = 'address-line3',\n ADDRESS_LEVEL_4 = 'address-level4',\n ADDRESS_LEVEL_3 = 'address-level3',\n ADDRESS_LEVEL_2 = 'address-level2',\n ADDRESS_LEVEL_1 = 'address-level1',\n COUNTRY = 'country',\n COUNTRY_NAME = 'country-name',\n POSTAL_CODE = 'postal-code',\n CC_NAME = 'cc-name',\n CC_GIVEN_NAME = 'cc-given-name',\n CC_ADDITIONAL_NAME = 'cc-additional-name',\n CC_FAMILY_NAME = 'cc-family-name',\n CC_NUMBER = 'cc-number',\n CC_EXP = 'cc-exp',\n CC_EXP_MONTH = 'cc-exp-month',\n CC_EXP_YEAR = 'cc-exp-year',\n CC_CSC = 'cc-csc',\n CC_TYPE = 'cc-type',\n TRANSACTION_CURRENCY = 'transaction-currency',\n TRANSACTION_AMOUNT = 'transaction-amount',\n LANGUAGE = 'language',\n BDAY = 'bday',\n BDAY_DAY = 'bday-day',\n BDAY_MONTH = 'bday-month',\n BDAY_YEAR = 'bday-year',\n SEX = 'sex',\n URL = 'url',\n PHOTO = 'photo',\n TEL = 'tel',\n TEL_COUNTRY_CODE = 'tel-country-code',\n TEL_NATIONAL = 'tel-national',\n TEL_AREA_CODE = 'tel-area-code',\n TEL_LOCAL = 'tel-local',\n TEL_LOCAL_PREFIX = 'tel-local-prefix',\n TEL_LOCAL_SUFFIX = 'tel-local-suffix',\n TEL_EXTENSION = 'tel-extension',\n EMAIL = 'email',\n IMPP = 'impp',\n}\n\n/**\n * Official non-`section-*` HTML autocomplete modifiers.\n * Rendering code is responsible for placing them in spec order.\n */\nexport enum AutocompleteModifier {\n SHIPPING = 'shipping',\n BILLING = 'billing',\n HOME = 'home',\n WORK = 'work',\n MOBILE = 'mobile',\n FAX = 'fax',\n PAGER = 'pager',\n WEBAUTHN = 'webauthn',\n}\n\n\n// ================================\n// FORM FIELD CHROME MODES\n// ================================\n\n//------------------------------------------------------------------------------------------------\n// CHROME MODES — display and edit context\n//------------------------------------------------------------------------------------------------\n\n/**\n * Chrome layout mode for display context (detail/read-only views).\n * Controls how the field wrapper (label, value, description) is arranged.\n */\nexport const DisplayChromeMode = {\n /** Label above, value below, description below value (default). */\n STACKED: 'stacked',\n /**\n * Label + description inline-start, value inline-end (settings page style).\n * The read-mode counterpart of `EditChromeMode.SETTINGS_ROW` — pairing the two\n * keeps a view→edit drill (e.g. inside the Settings Hub) visually coherent: the\n * value sits where its control will appear.\n */\n SETTINGS_ROW: 'settings_row',\n /** Label and value on the same line. */\n INLINE: 'inline',\n /** No label/description, just value (dense mode). */\n COMPACT: 'compact',\n /** No chrome at all — bare value output. */\n HIDDEN: 'hidden',\n} as const;\nexport type DisplayChromeMode = typeof DisplayChromeMode[keyof typeof DisplayChromeMode];\n\n/**\n * Chrome layout mode for edit context (forms).\n * Superset of DisplayChromeMode with form-specific modes (SETTINGS_ROW, RELAXED).\n */\nexport const EditChromeMode = {\n /** Label above, control below, description + error below control (default). */\n STACKED: 'stacked',\n /** Label + description left, control + error right (settings page style). */\n SETTINGS_ROW: 'settings_row',\n /** Control left, label + description right (switch/checkbox style). */\n INLINE: 'inline',\n /** Generous spacing, heading-size label (onboarding, OTP, wizard). */\n RELAXED: 'relaxed',\n /** No label/description, just control + error (dense mode). */\n COMPACT: 'compact',\n /** No chrome at all — bare control output. */\n HIDDEN: 'hidden',\n} as const;\nexport type EditChromeMode = typeof EditChromeMode[keyof typeof EditChromeMode];\n\n/**\n * Responsive chrome mode — either a single mode or per-breakpoint mapping.\n * When a breakpoint mapping is provided, FormFieldChrome resolves the effective\n * mode at runtime using useUI().\n */\nexport type ResponsiveChromeMode = EditChromeMode | Partial<Record<ViewportBreakpoint, EditChromeMode>>;\n\n/**\n * Responsive-aware value: either a single value or per-breakpoint overrides.\n * Used for chromeMode, forceHide, and other properties that may vary by viewport.\n */\nexport type ResponsiveAware<T> = T | Partial<Record<ViewportBreakpoint, T>>;\n\n\n// Compatible components for each schema type.\n// Provides compile-time type safety for component selection.\nexport type FormFieldSchemaTypeComponents = {\n // Use a mapped type so keys are truly `FieldSchemaType` (fixes TS2536 indexing errors).\n [K in FieldSchemaType]:\n K extends FieldSchemaType.STRING\n ? FormFieldComponent.INPUT\n | FormFieldComponent.TEXTAREA\n | FormFieldComponent.SELECT\n | FormFieldComponent.RADIO_GROUP\n | FormFieldComponent.DATE\n | FormFieldComponent.TIME\n | FormFieldComponent.DATETIME\n : K extends FieldSchemaType.NUMBER\n ? FormFieldComponent.INPUT\n | FormFieldComponent.SLIDER\n | FormFieldComponent.SELECT\n | FormFieldComponent.RADIO_GROUP\n : K extends FieldSchemaType.BIGINT\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.BOOLEAN\n ? FormFieldComponent.SWITCH\n | FormFieldComponent.CHECKBOX\n | FormFieldComponent.SELECT\n | FormFieldComponent.RADIO_GROUP\n : K extends FieldSchemaType.ENUM\n ? FormFieldComponent.SELECT\n | FormFieldComponent.RADIO_GROUP\n : K extends FieldSchemaType.DATE\n ? FormFieldComponent.DATE\n | FormFieldComponent.DATETIME\n | FormFieldComponent.INPUT\n : K extends FieldSchemaType.TIME\n ? FormFieldComponent.TIME\n | FormFieldComponent.INPUT\n : K extends FieldSchemaType.DATETIME\n ? FormFieldComponent.DATETIME\n | FormFieldComponent.INPUT\n : K extends FieldSchemaType.RANGE_NUMBER\n ? FormFieldComponent.RANGE_SLIDER\n : K extends FieldSchemaType.RANGE_DATE\n ? FormFieldComponent.DATE_RANGE\n : K extends FieldSchemaType.RANGE_DATETIME\n ? FormFieldComponent.DATETIME_RANGE\n : K extends FieldSchemaType.RANGE_TIME\n ? FormFieldComponent.TIME_RANGE\n : K extends FieldSchemaType.RANGE_BIGDECIMAL\n ? FormFieldComponent.BIGDECIMAL_RANGE\n : K extends FieldSchemaType.RANGE_MONEY\n ? FormFieldComponent.MONEY_RANGE\n : K extends FieldSchemaType.MONEY\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.DURATION\n ? FormFieldComponent.DURATION\n : K extends FieldSchemaType.PHONE\n ? FormFieldComponent.PHONE\n : K extends FieldSchemaType.BIGDECIMAL\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.CODE\n ? FormFieldComponent.TEXTAREA\n : K extends FieldSchemaType.FILE\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.ARRAY\n ? FormFieldComponent.CHECKBOX_GROUP // For arrays of enums (multi-select)\n | FormFieldComponent.SELECT // For arrays rendered as multi-select dropdown\n : K extends FieldSchemaType.SET\n ? FormFieldComponent.INPUT\n | FormFieldComponent.CHECKBOX_GROUP // For sets of enums (multi-select)\n | FormFieldComponent.SELECT // For sets rendered as multi-select dropdown\n : K extends FieldSchemaType.TUPLE\n ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.UNKNOWN\n ? FormFieldComponent.INPUT\n : never;\n};\n\n// Get compatible component type for a schema type.\n// Use this for type-safe component assignment.\nexport type FormComponentForSchemaType<T extends FieldSchemaType> = FormFieldSchemaTypeComponents[T];\n\n// Default component for each schema type.\nexport type FormFieldSchemaTypeDefaultComponent = {\n [K in FieldSchemaType]:\n K extends FieldSchemaType.STRING ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.NUMBER ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.BIGINT ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.BOOLEAN ? FormFieldComponent.SWITCH\n : K extends FieldSchemaType.ENUM ? FormFieldComponent.SELECT\n : K extends FieldSchemaType.DATE ? FormFieldComponent.DATE\n : K extends FieldSchemaType.TIME ? FormFieldComponent.TIME\n : K extends FieldSchemaType.DATETIME ? FormFieldComponent.DATETIME\n : K extends FieldSchemaType.RANGE_NUMBER ? FormFieldComponent.RANGE_SLIDER\n : K extends FieldSchemaType.RANGE_DATE ? FormFieldComponent.DATE_RANGE\n : K extends FieldSchemaType.RANGE_DATETIME ? FormFieldComponent.DATETIME_RANGE\n : K extends FieldSchemaType.RANGE_TIME ? FormFieldComponent.TIME_RANGE\n : K extends FieldSchemaType.RANGE_BIGDECIMAL ? FormFieldComponent.BIGDECIMAL_RANGE\n : K extends FieldSchemaType.RANGE_MONEY ? FormFieldComponent.MONEY_RANGE\n : K extends FieldSchemaType.MONEY ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.DURATION ? FormFieldComponent.DURATION\n : K extends FieldSchemaType.PHONE ? FormFieldComponent.PHONE\n : K extends FieldSchemaType.BIGDECIMAL ? FormFieldComponent.INPUT\n : K extends FieldSchemaType.CODE ? FormFieldComponent.TEXTAREA\n : K extends FieldSchemaType.FILE ? FormFieldComponent.INPUT\n : FormFieldComponent.INPUT;\n};\n\n// Get default component type for a schema type.\nexport type DefaultFormComponentForSchemaType<T extends FieldSchemaType> = FormFieldSchemaTypeDefaultComponent[T];\n\n\n\n// Decorator configuration types\nexport type DecoratorConfig<T extends ZodDecorator> = {\n ref: T;\n params: ZodDecorator_ParamsType[T];\n};\n\nexport type DecoratorInput<T extends ZodDecorator = ZodDecorator> =\n | T\n | DecoratorConfig<T>;\n\n\n\n///=======================================================================================================================\n/// DISPLAY FIELD COMPONENT TYPES\n///=======================================================================================================================\n\nexport enum DisplayFieldComponent {\n // Basic/fallback\n SIMPLE_TEXT = 'simple-text',\n\n // Primitive types\n STRING = 'string',\n NUMBER = 'number',\n BOOLEAN = 'boolean',\n ENUM = 'enum',\n\n // Date/Time types\n DATE = 'date',\n TIME = 'time',\n DATETIME = 'datetime',\n\n // Special primitive types\n CODE = 'code',\n FILE = 'file',\n MONEY = 'money',\n BIGDECIMAL = 'bigdecimal',\n DURATION = 'duration',\n PHONE = 'phone',\n\n // Range types\n RANGE_NUMBER = 'range-number',\n RANGE_DATE = 'range-date',\n RANGE_TIME = 'range-time',\n RANGE_DATETIME = 'range-datetime',\n RANGE_BIGDECIMAL = 'range-bigdecimal',\n RANGE_MONEY = 'range-money',\n}\n\n// Compatible display components for each schema type.\n// Provides compile-time type safety for display component selection.\nexport type DisplayFieldSchemaTypeComponents = {\n // Use a mapped type so keys are truly `FieldSchemaType` (fixes TS2536 indexing errors).\n [K in FieldSchemaType]:\n K extends FieldSchemaType.STRING\n ? DisplayFieldComponent.STRING | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.NUMBER\n ? DisplayFieldComponent.NUMBER | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.BIGINT\n ? DisplayFieldComponent.NUMBER | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.BOOLEAN\n ? DisplayFieldComponent.BOOLEAN | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.ENUM\n ? DisplayFieldComponent.ENUM | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.DATE\n ? DisplayFieldComponent.DATE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.TIME\n ? DisplayFieldComponent.TIME | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.DATETIME\n ? DisplayFieldComponent.DATETIME | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.OBJECT\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.ARRAY\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RECORD\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.MAP\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_NUMBER\n ? DisplayFieldComponent.RANGE_NUMBER | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_DATE\n ? DisplayFieldComponent.RANGE_DATE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_TIME\n ? DisplayFieldComponent.RANGE_TIME | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_DATETIME\n ? DisplayFieldComponent.RANGE_DATETIME | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_BIGDECIMAL\n ? DisplayFieldComponent.RANGE_BIGDECIMAL | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_MONEY\n ? DisplayFieldComponent.RANGE_MONEY | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.MONEY\n ? DisplayFieldComponent.MONEY | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.DURATION\n ? DisplayFieldComponent.DURATION | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.PHONE\n ? DisplayFieldComponent.PHONE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.BIGDECIMAL\n ? DisplayFieldComponent.BIGDECIMAL | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.CODE\n ? DisplayFieldComponent.CODE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.FILE\n ? DisplayFieldComponent.FILE | DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.SET\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.TUPLE\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.VERSIONED_FOREIGN_KEY\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.VERSIONED_OBJECT\n ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.UNKNOWN\n ? DisplayFieldComponent.SIMPLE_TEXT\n : never;\n};\n\n// Get compatible display component type for a schema type.\n// Use this for type-safe display component assignment.\nexport type DisplayComponentForSchemaType<T extends FieldSchemaType> = DisplayFieldSchemaTypeComponents[T];\n\n// Default display component for each schema type.\nexport type DisplayFieldSchemaTypeDefaultComponent = {\n [K in FieldSchemaType]:\n K extends FieldSchemaType.STRING ? DisplayFieldComponent.STRING\n : K extends FieldSchemaType.NUMBER ? DisplayFieldComponent.NUMBER\n : K extends FieldSchemaType.BIGINT ? DisplayFieldComponent.NUMBER\n : K extends FieldSchemaType.BOOLEAN ? DisplayFieldComponent.BOOLEAN\n : K extends FieldSchemaType.ENUM ? DisplayFieldComponent.ENUM\n : K extends FieldSchemaType.DATE ? DisplayFieldComponent.DATE\n : K extends FieldSchemaType.TIME ? DisplayFieldComponent.TIME\n : K extends FieldSchemaType.DATETIME ? DisplayFieldComponent.DATETIME\n : K extends FieldSchemaType.OBJECT ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.ARRAY ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RECORD ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.MAP ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.RANGE_NUMBER ? DisplayFieldComponent.RANGE_NUMBER\n : K extends FieldSchemaType.RANGE_DATE ? DisplayFieldComponent.RANGE_DATE\n : K extends FieldSchemaType.RANGE_TIME ? DisplayFieldComponent.RANGE_TIME\n : K extends FieldSchemaType.RANGE_DATETIME ? DisplayFieldComponent.RANGE_DATETIME\n : K extends FieldSchemaType.RANGE_BIGDECIMAL ? DisplayFieldComponent.RANGE_BIGDECIMAL\n : K extends FieldSchemaType.RANGE_MONEY ? DisplayFieldComponent.RANGE_MONEY\n : K extends FieldSchemaType.MONEY ? DisplayFieldComponent.MONEY\n : K extends FieldSchemaType.DURATION ? DisplayFieldComponent.DURATION\n : K extends FieldSchemaType.PHONE ? DisplayFieldComponent.PHONE\n : K extends FieldSchemaType.BIGDECIMAL ? DisplayFieldComponent.BIGDECIMAL\n : K extends FieldSchemaType.CODE ? DisplayFieldComponent.CODE\n : K extends FieldSchemaType.FILE ? DisplayFieldComponent.FILE\n : K extends FieldSchemaType.SET ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.TUPLE ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.VERSIONED_FOREIGN_KEY ? DisplayFieldComponent.SIMPLE_TEXT\n : K extends FieldSchemaType.VERSIONED_OBJECT ? DisplayFieldComponent.SIMPLE_TEXT\n : DisplayFieldComponent.SIMPLE_TEXT;\n};\n\n// Get default display component type for a schema type.\nexport type DefaultDisplayComponentForSchemaType<T extends FieldSchemaType> = DisplayFieldSchemaTypeDefaultComponent[T];\n\n\n\n\n\n//------------------------------------------------------------------------------------------------\n// FORM FIELD\n//------------------------------------------------------------------------------------------------\n\n// =============================================================================\n// SECTION MODE - Unified enum for section rendering\n// =============================================================================\n\n/**\n * How a section is rendered — both per-section appearance and container grouping.\n *\n * **Solo modes** (render in place, no grouping):\n * - DEFAULT: Standard section with border and padding\n * - CARD: Wrapped in a card container with shadow\n * - GHOST: Minimal container without visual styling\n * - COLLAPSIBLE: Expandable/collapsible section with trigger\n *\n * **Container modes** (sections sharing the same mode are grouped together,\n * rendered at the position of the first occurrence):\n *\n * @category Layout-based (all sections visible simultaneously)\n * - INLINE: Stacked vertically\n * - GRID: CSS Grid layout with configurable columns\n * - COLUMNS: Multi-column layout (newspaper style)\n *\n * @category Navigation-based (one section visible at a time)\n * - TABS: Horizontal tabs navigation\n * - VERTICAL_TABS: Vertical tabs (side navigation)\n * - PILLS: Pill/segment navigation (compact)\n *\n * @category Expandable (toggle section visibility)\n * - ACCORDION: Each section independently collapsible\n * - EXPANDABLE: \"Show more\" button reveals additional sections\n *\n * @category Guided (sequential, with indicators)\n * - STEPPER: Step-by-step with step indicators\n * - TIMELINE: Chronological progression (vertical timeline)\n *\n * NOTE: Wizard is NOT included — it's a higher-level layout pattern\n * that contains sections, not a section rendering mode.\n */\nexport enum SectionMode {\n // Solo (render in place, no grouping)\n DEFAULT = 'default',\n CARD = 'card',\n GHOST = 'ghost',\n COLLAPSIBLE = 'collapsible',\n\n // Layout-based (all sections visible simultaneously)\n INLINE = 'inline',\n GRID = 'grid',\n COLUMNS = 'columns',\n\n // Navigation-based (one section visible at a time)\n TABS = 'tabs',\n VERTICAL_TABS = 'vertical_tabs',\n PILLS = 'pills',\n\n // Expandable (toggle section visibility)\n ACCORDION = 'accordion',\n EXPANDABLE = 'expandable',\n\n // Guided (sequential, with indicators)\n STEPPER = 'stepper',\n TIMELINE = 'timeline',\n}\n\n/** Solo modes — render in place, no grouping. Valid on `<Section appearance>`. */\nexport type SoloSectionMode =\n | SectionMode.DEFAULT\n | SectionMode.CARD\n | SectionMode.GHOST\n | SectionMode.COLLAPSIBLE;\n\n/** Container modes — sections sharing the same mode are grouped into one container. */\nexport type ContainerSectionMode = Exclude<SectionMode, SoloSectionMode>;\n\n// =============================================================================\n// OVERLAY CONTAINER MODE - UI Abstraction for Overlay Rendering\n// =============================================================================\n\n/**\n * OverlayContainerMode - How overlay containers are rendered.\n * Controls the presentation style of standalone dismissable containers.\n *\n * @category Centered overlays (modal)\n * - DIALOG: Standard centered modal\n * - ALERT: Confirmation dialog with action buttons\n * - COMMAND: Command palette (search-focused)\n * - LIGHTBOX: Full-screen media viewer with navigation\n *\n * @category Side panels (modal)\n * - SHEET: Side panel (direction via `side` prop)\n *\n * @category Mobile-optimized (modal)\n * - DRAWER: Swipeable drawer with snap points\n * - ACTION_SHEET: iOS-style action list (bottom)\n *\n * @category Non-blocking\n * - POPOVER: Anchored contextual overlay\n * - TOAST: Auto-dismiss notification\n */\nexport enum OverlayContainerMode {\n // Centered overlays (modal)\n DIALOG = 'dialog',\n ALERT = 'alert',\n COMMAND = 'command',\n LIGHTBOX = 'lightbox',\n\n // Side panels (modal)\n SHEET = 'sheet',\n\n // Mobile-optimized (modal)\n DRAWER = 'drawer',\n ACTION_SHEET = 'action_sheet',\n\n // Non-blocking\n POPOVER = 'popover',\n TOAST = 'toast',\n}\n\n/**\n * Layout orientation / display direction (horizontal | vertical)\n */\nexport enum DisplayDirection {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\n/**\n * Horizontal alignment for UI elements (popovers, menus, action bars, etc.)\n */\nexport enum HorizontalAlign {\n START = 'start',\n CENTER = 'center',\n END = 'end',\n}\n\n//------------------------------------------------------------------------------------------------\n/**\n * @wildo_source:part:start zod.decorators.display-edit-modes facet:layer:frontend facet:family:ui facet:surface:form facet:surface:display\n *\n * Frontend UI vocabulary for choosing how a field renders and edits.\n *\n * These values are not the persisted resource semantics themselves. They are\n * consumed by the frontend resource UI behavior layer, typically in\n * files like `frontend/src/modules/<module>/resources/<resource>/<resource>.ui-behavior.tsx`, where the AI\n * calls decorators like `.stringUI()`, `.enumUI()`, `.booleanUI()`, etc. on the\n * schema shape exposed to `resourceUIBehavior(...)`.\n *\n * Keep these mode enums in the framework source as the canonical list of\n * supported display/edit behaviors. Authoring skills and generated knowledge\n * should reference these definitions instead of copying literal mode tables\n * into markdown by hand.\n */\n// BOOLEAN DISPLAY POLICY\n//------------------------------------------------------------------------------------------------\n\n/**\n * Labelling values for boolean fields\n */\nexport const BooleanLabellingValue = {\n YES_NO: 'yes/no',\n TRUE_FALSE: 'true/false',\n ON_OFF: 'on/off',\n ENABLED_DISABLED: 'enabled/disabled',\n ACTIVE_INACTIVE: 'active/inactive',\n} as const;\nexport type BooleanLabellingValue = typeof BooleanLabellingValue[keyof typeof BooleanLabellingValue];\n\n/**\n * Display mode for boolean fields\n */\nexport const BooleanDisplayMode = {\n RAW: 'raw',\n CHECKMARK: 'checkmark',\n EDIT_LIKE: 'edit_like',\n} as const;\nexport type BooleanDisplayMode = typeof BooleanDisplayMode[keyof typeof BooleanDisplayMode];\n\n/**\n * Edit mode for boolean fields\n */\nexport const BooleanEditMode = {\n TOGGLE: 'toggle',\n SWITCH: 'switch',\n CHECKBOX: 'checkbox',\n RADIO: 'radio',\n} as const;\nexport type BooleanEditMode = typeof BooleanEditMode[keyof typeof BooleanEditMode];\n\n//------------------------------------------------------------------------------------------------\n// STRING DISPLAY POLICY\n//------------------------------------------------------------------------------------------------\n\n/**\n * String display modes for rendering string values\n */\nexport const StringDisplayMode = {\n TEXT: 'text',\n TRUNCATE: 'truncate',\n MULTILINE: 'multiline',\n /**\n * Render the value as rich markdown (GFM: headings, lists, tables, links,\n * task lists, fenced code). For long-form authored content — descriptions,\n * notes, documentation fields. Headings are demoted for embedded context\n * (a `#` inside a field body never competes with the page title) and every\n * element is styled through the active theme's typography recipes. Pair\n * with `edit.editMode: MARKDOWN` (syntax-tinted source editor) — or plain\n * `TEXTAREA` — the edit side stays markdown SOURCE either way.\n */\n MARKDOWN: 'markdown',\n /**\n * A MACHINE IDENTIFIER — a slug, a ref, an addressable key (`success-criterion-…`). Rendered\n * small, muted and monospace so it stays greppable and verbatim while RECEDING behind the prose\n * it identifies. Use for values a reader needs to copy or trace, never to read as content.\n */\n IDENTIFIER: 'identifier',\n COLOR: 'color',\n LINK: 'link',\n EMAIL: 'email',\n BADGE: 'badge',\n COPY: 'copy',\n SECRET: 'secret',\n} as const;\nexport type StringDisplayMode = typeof StringDisplayMode[keyof typeof StringDisplayMode];\n\n/**\n * String edit modes for form components\n */\nexport const StringEditMode = {\n INPUT: 'input',\n TEXTAREA: 'textarea',\n COLOR: 'color',\n PASSWORD: 'password',\n OTP: 'otp',\n /**\n * Markdown SOURCE editor (CodeMirror-backed, syntax-tinted, theme-token\n * styled). The stored value stays plain markdown source — display-side\n * rendering remains owned by `StringDisplayMode.MARKDOWN` (Streamdown).\n * This is deliberately NOT a WYSIWYG mode; a rich visual editor is a\n * separate future edit mode/component.\n */\n MARKDOWN: 'markdown',\n} as const;\nexport type StringEditMode = typeof StringEditMode[keyof typeof StringEditMode];\n\n//------------------------------------------------------------------------------------------------\n// NUMBER DISPLAY POLICY\n//------------------------------------------------------------------------------------------------\n\n/**\n * Number display modes for rendering number values\n */\nexport const NumberDisplayMode = {\n RAW: 'raw',\n FORMATTED: 'formatted',\n PERCENTAGE: 'percentage',\n COMPACT: 'compact',\n ORDINAL: 'ordinal',\n BYTES: 'bytes',\n} as const;\nexport type NumberDisplayMode = typeof NumberDisplayMode[keyof typeof NumberDisplayMode];\n\n/**\n * Number edit modes for form components\n */\nexport const NumberEditMode = {\n INPUT: 'input',\n SLIDER: 'slider',\n STEPPER: 'stepper',\n} as const;\nexport type NumberEditMode = typeof NumberEditMode[keyof typeof NumberEditMode];\n\n\n/**\n * Scale modes for percentage display.\n * - NORMALIZED: value is 0–1, Intl.NumberFormat's style:'percent' handles ×100\n * - PERCENT: value is already 0–100, must be divided by 100 before passing to Intl\n */\nexport const PercentageScale = {\n NORMALIZED: 'normalized',\n PERCENT: 'percent',\n} as const;\nexport type PercentageScale = typeof PercentageScale[keyof typeof PercentageScale];\n\n//------------------------------------------------------------------------------------------------\n// BIGDECIMAL DISPLAY / EDIT MODES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Display mode for BigDecimal fields.\n * Subset of NumberDisplayMode — COMPACT/ORDINAL/BYTES excluded for arbitrary precision numbers.\n */\nexport const BigDecimalDisplayMode = {\n RAW: 'raw',\n FORMATTED: 'formatted',\n PERCENTAGE: 'percentage',\n} as const;\nexport type BigDecimalDisplayMode = typeof BigDecimalDisplayMode[keyof typeof BigDecimalDisplayMode];\n\n/**\n * Edit mode for BigDecimal fields.\n * Only INPUT — SLIDER/STEPPER are not applicable for arbitrary precision numbers.\n */\nexport const BigDecimalEditMode = {\n INPUT: 'input',\n} as const;\nexport type BigDecimalEditMode = typeof BigDecimalEditMode[keyof typeof BigDecimalEditMode];\n/** @wildo_source:part:end zod.decorators.display-edit-modes */\n\n//------------------------------------------------------------------------------------------------\n// ENUM DISPLAY POLICY\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.enums.frontend-handling facet:layer:frontend facet:layer:shared facet:family:enum facet:family:ui facet:surface:form facet:surface:display\n *\n * Enum display modes for rendering enum values\n */\nexport const EnumDisplayMode = {\n TEXT: 'text',\n BADGE: 'badge',\n ICON: 'icon',\n CARD: 'card',\n} as const;\nexport type EnumDisplayMode = typeof EnumDisplayMode[keyof typeof EnumDisplayMode];\n\n/**\n * Enum edit modes for form components\n */\nexport const EnumEditMode = {\n SELECT: 'select',\n RADIO: 'radio',\n RADIO_ICON_ONLY: 'radio_icon_only',\n TOGGLE: 'toggle',\n TOGGLE_ICON_ONLY: 'toggle_icon_only',\n CARD: 'card',\n CARD_ICON_ONLY: 'card_icon_only',\n COMBOBOX: 'combobox',\n} as const;\nexport type EnumEditMode = typeof EnumEditMode[keyof typeof EnumEditMode];\n\n/**\n * Layout direction for form layouts\n */\nexport const LayoutDirection = {\n HORIZONTAL: 'horizontal',\n VERTICAL: 'vertical',\n} as const;\nexport type LayoutDirection = typeof LayoutDirection[keyof typeof LayoutDirection];\n\n/**\n * Semantic badge variants for enum display.\n * These map 1:1 to the Badge component's `variant` prop in presets-components.\n */\nexport const BadgeSemanticVariant = {\n DEFAULT: 'default',\n SECONDARY: 'secondary',\n OUTLINE: 'outline',\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n DESTRUCTIVE: 'destructive',\n} as const;\nexport type BadgeSemanticVariant = typeof BadgeSemanticVariant[keyof typeof BadgeSemanticVariant];\n\n/**\n * An icon reference — either a React component (Lucide, custom SVG) or\n * a string key (StandardIconReference) resolved via the icon registry.\n *\n * When `string`: resolved at render time through `renderIcon(key, opts)`.\n * When `ComponentType`: rendered directly via `React.createElement(icon, props)`.\n */\nexport type IconLike = ComponentType<{ size?: number; color?: string; className?: string; strokeWidth?: number }> | string;\n\n/**\n * Per-value display configuration for enum fields.\n * Groups all visual properties for a single enum value in one place.\n */\nexport interface EnumValueDisplayConfig {\n /** Badge variant / color for this enum value */\n color?: BadgeSemanticVariant;\n /** Icon for this enum value — React component or StandardIconReference string */\n icon?: IconLike;\n}\n/** @wildo_source:part:end zod.decorators.enums.frontend-handling */\n\n\n/**\n * Updater function accepted by any decorator with object params.\n *\n * Receives the current metadata value (or `undefined` if no prior decorator\n * or if the prior value is the `true` boolean shorthand). Returns the new value.\n *\n * For mergeable primitive decorators (`{primitive}UI()` and `{primitive}Spec()`),\n * the updater bypasses the normal deep-merge behavior — the returned value\n * replaces entirely.\n *\n * @example\n * ```ts\n * schema.enumUI((current) => ({\n * ...current,\n * defaultColor: 'secondary',\n * values: { ...current?.values, active: { color: 'success' } },\n * }));\n *\n * schema.formComponent((current) => ({\n * ...current,\n * component: 'custom-input',\n * hideLabel: true,\n * }));\n * ```\n */\nexport type DecoratorUpdater<T> = (current: T | undefined) => T;\n\n//------------------------------------------------------------------------------------------------\n// FOREIGN KEY DISPLAY PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.foreign-key-display-mode facet:layer:frontend facet:family:ui facet:surface:display facet:surface:picker\n *\n * Foreign-key reference display vocabulary — how a foreign-key field renders, both\n * as a stored VALUE in read views and as each ROW in the reference picker's\n * dropdown (the picker is shared by forms and collection filters). Authored via\n * `.foreignKeyUI(...)` from `@wildo-ai/zod-decorators` on the FK field:\n * - `display.mode` — how the saved FK value renders in a read view.\n * - `edit.optionDisplayMode` — how each picker dropdown ROW renders while selecting.\n *\n * Modes:\n * - `ID`: the raw FK id string. As a picker row this is treated as `LABEL`.\n * - `LABEL`: a one-line resolved label via `getFrontendResourceLabel`. The default on\n * BOTH surfaces — see {@link DEFAULT_FOREIGN_KEY_DISPLAY_MODE} and\n * {@link DEFAULT_FOREIGN_KEY_OPTION_DISPLAY_MODE}.\n * - `SUMMARY`: the referenced resource's summary view — its summary fields with NO\n * action bar (a compact card). Always an opt-in, on both surfaces.\n *\n * \"summary\" here is about FK RENDERING, not API data shape (`DataMode.SUMMARY`) or\n * operation-bar density (`ResourceOperationDisplayMode.SUMMARY`).\n *\n * @example\n * // Make the picker dropdown rows show the referenced resource's summary card:\n * assigneeUserId: z.string().isForeignKey().foreignKeyUI({\n * edit: { optionDisplayMode: ForeignKeyDisplayMode.SUMMARY },\n * })\n */\nexport const ForeignKeyDisplayMode = {\n ID: 'id',\n LABEL: 'label',\n SUMMARY: 'summary',\n} as const;\n\nexport type ForeignKeyDisplayMode = typeof ForeignKeyDisplayMode[keyof typeof ForeignKeyDisplayMode];\n\n/**\n * The mode an FK's stored VALUE renders in when the field authors no\n * `.foreignKeyUI({ display: { mode } })`.\n *\n * **This is the single source for that default.** Every site that has to supply a\n * fallback display mode derives from this constant rather than restating a member of\n * {@link ForeignKeyDisplayMode}. It exists because the default was previously declared\n * twice and the two declarations DISAGREED — the metadata reader said `LABEL`, the\n * display preset said `SUMMARY` — so the answer an app author got depended on which\n * resolution path happened to run, and the prose above this enum documented the losing\n * one.\n *\n * `LABEL` is the default because it is the cheap, composable rendering: one resolved\n * line that fits a table cell, a detail row and a dense list alike. `SUMMARY` renders a\n * card of the referenced record's summary fields — appropriate when the parent's\n * details matter AT the point of reference, which is a per-field authoring judgement,\n * not something a framework can assume for every FK in an application.\n *\n * @example\n * // Opt a single field into the card rendering:\n * todoListId: z.string().isForeignKey().foreignKeyUI({\n * display: { mode: ForeignKeyDisplayMode.SUMMARY },\n * })\n */\nexport const DEFAULT_FOREIGN_KEY_DISPLAY_MODE: ForeignKeyDisplayMode = ForeignKeyDisplayMode.LABEL;\n\n/**\n * The mode each ROW of the reference picker's dropdown renders in when the field\n * authors no `.foreignKeyUI({ edit: { optionDisplayMode } })`.\n *\n * **This is the single source for that default**, and it is deliberately a SEPARATE\n * constant from {@link DEFAULT_FOREIGN_KEY_DISPLAY_MODE}. The two answer different\n * questions — \"how does a stored reference read?\" versus \"how does a candidate read\n * while I am choosing one?\" — and a framework that collapsed them would make one\n * surface's default un-tunable without moving the other. They currently coincide on\n * `LABEL`; that agreement is a fact about today's values, not a shared identity.\n */\nexport const DEFAULT_FOREIGN_KEY_OPTION_DISPLAY_MODE: ForeignKeyDisplayMode = ForeignKeyDisplayMode.LABEL;\n/** @wildo_source:part:end zod.decorators.foreign-key-display-mode */\n\n/**\n * Polymorphic FK variant definition.\n *\n * Describes one scope-branch of a polymorphic foreign key. A variant has two\n * complementary roles, depending on whether the FK is renamed-per-holder or\n * shared-with-discriminator (see {@link ForeignKeyStructuralParams.polymorphicVariants}):\n *\n * 1. **Rename role** (`parentResourceType` + `parentFieldIdentifier`): when the\n * FK's HOLDER resource is polymorphically expanded into per-scope variants,\n * the factory uses these to rename the FK field per variant — e.g.\n * `billingAccountId` → `organizationBillingAccountId`.\n * 2. **Discriminated-resolution role** (`discriminatorValue`): when the FK is a\n * single SHARED field on a flat holder that points at a polymorphic branch\n * GROUP, this value links the holder record's discriminator field value to\n * THIS branch. See {@link ForeignKeyStructuralParams.polymorphicDiscriminatorField}.\n */\nexport interface PolymorphicFkVariant {\n /** The parent (scope-root) resource type, e.g. `'organizations'` / `'users'`. */\n parentResourceType: string;\n /** The parent's field identifier, e.g. `'organizationId'` / `'userId'`. */\n parentFieldIdentifier: string;\n /**\n * Value of the FK's `polymorphicDiscriminatorField` (read off the SAME record)\n * that selects this variant's branch. Only meaningful for shared-field\n * discriminated FKs; ignored by the per-variant rename path. E.g. a referral's\n * `referrerScopeType === 'organizations'` selects the organizations variant,\n * whose branch is `organizationBillingAccounts`.\n */\n discriminatorValue?: string;\n}\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Structural FK params — backend/factory-relevant subset.\n * Stays on `IS_FOREIGN_KEY`. UI-specific params (mode, linkable,\n * displayPresetOverride) live on `ForeignKeyUIParams` via `.foreignKeyUI()`.\n */\nexport interface ForeignKeyStructuralParams {\n /**\n * Marks this FK as polymorphic over a set of scope branches.\n *\n * - On a resource that is itself polymorphically expanded, these drive the\n * per-variant FK field RENAME (e.g. `billingAccountId` →\n * `organizationBillingAccountId`).\n * - On a FLAT resource that holds ONE shared FK to a polymorphic branch group\n * (e.g. a referral's `referrerBillingAccountId` → user OR organization\n * billing account), combine with {@link polymorphicDiscriminatorField}: each\n * variant carries a `discriminatorValue`, and the concrete branch is\n * resolved PER RECORD from the discriminator field. The single-valued\n * registry FK→type map keeps a non-authoritative representative for these\n * fields; the per-record resolver is authoritative for display/links.\n */\n polymorphicVariants?: PolymorphicFkVariant[];\n /**\n * Sibling field name (on the SAME record) whose value selects which\n * {@link polymorphicVariants} branch this record's FK points at. Required to\n * turn `polymorphicVariants` into a per-record discriminated FK; pairs with\n * each variant's `discriminatorValue`. The value is matched against the\n * candidate branches' primary scope, so it typically holds a scope-type enum\n * (e.g. `referrerScopeType`). Without it, `polymorphicVariants` is rename-only.\n */\n polymorphicDiscriminatorField?: string;\n /**\n * EXPLICIT target resource type, for an FK whose FIELD NAME cannot resolve it.\n *\n * The frontend resolves a reference field's target through the field-name → resource map\n * (enriched from relationships' `foreignKeyField`). That works only when the field is named for\n * its target (`assignedToUserId`) or a relationship declares it — and relationship FK names are\n * held to the `Id`/`Ids` convention. A field that references a resource under its OWN vocabulary\n * (`icpRefs` inside a specification document, a rename-only FK) has no honest entry in that map;\n * declaring the target here lets the reference display resolve, label and navigate it without\n * bending the field's name or the map's uniqueness.\n *\n * Takes precedence over the field-name map; polymorphic variants (above) still win over both,\n * because a per-record discriminator is more specific than any static declaration.\n */\n referencedResourceType?: string;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n\n//------------------------------------------------------------------------------------------------\n// RANGE SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Supported types for range schemas.\n */\nexport enum RangeType {\n NUMBER = 'number',\n DATE = 'date',\n DATETIME = 'datetime',\n TIME = 'time',\n BIGDECIMAL = 'bigdecimal',\n MONEY = 'money',\n}\n/**\n * Type mapping for range schema outputs.\n * Maps RangeType to the resulting schema's inferred TypeScript type.\n */\n/**\n * Type mapping for range schema outputs.\n * Maps RangeType to the resulting schema's inferred TypeScript type.\n * Note: Money and BigDecimal have their actual types, but for range purposes,\n * the actual Zod schemas (MoneyValueSchema, BigDecimalValueSchema) define the real structure.\n */\nexport type RangeTypeMapping = {\n [RangeType.NUMBER]: number;\n [RangeType.DATE]: Date;\n [RangeType.DATETIME]: string; // ISO datetime string\n [RangeType.TIME]: string; // ISO time string (HH:MM:SS)\n [RangeType.BIGDECIMAL]: string; // BigDecimal string value (validated by BigDecimalValueSchema)\n [RangeType.MONEY]: { amount: bigint; currency: string; decimals: number }; // MoneyValue object\n};\n\n/**\n * Min/max constraint value types based on range type.\n */\nexport type RangeConstraintValue = number | Date | string;\n\n\nexport interface RangeSchemaMetadata {\n /** Marker for detecting range schemas */\n isRange: true;\n /** The type of values in the range */\n type: RangeType;\n /** Whether the 'from' field is optional (default: true) */\n fromOptional: boolean;\n /** Whether the 'to' field is optional (default: true) */\n toOptional: boolean;\n /** Minimum allowed value (for UI hints and validation) */\n min?: RangeConstraintValue;\n /** Maximum allowed value (for UI hints and validation) */\n max?: RangeConstraintValue;\n}\n\n/**\n * Options for creating a range schema.\n */\nexport interface RangeSchemaOptions {\n /** Whether the 'from' field is optional (default: true) */\n fromOptional?: boolean;\n /** Whether the 'to' field is optional (default: true) */\n toOptional?: boolean;\n /** Minimum allowed value (stored in metadata for UI hints) */\n min?: RangeConstraintValue;\n /** Maximum allowed value (stored in metadata for UI hints) */\n max?: RangeConstraintValue;\n}\n\n// Range type for range schemas (matches RangeType from saas-models).\n// Duplicated here to avoid circular dependency.\nexport enum RangeSchemaType {\n NUMBER = 'number', // Number schemas (z.number, z.int)\n DATE = 'date', // Date schemas (z.date)\n DATETIME = 'datetime', // Datetime schemas (z.datetime)\n TIME = 'time', // Time schemas (z.time)\n BIGDECIMAL = 'bigdecimal', // BigDecimal schemas (z_bigdecimal)\n MONEY = 'money', // Money schemas (z_money)\n}\n\n\n// Map range type to its default component.\nexport const RangeTypeToComponent: Record<RangeSchemaType, FormFieldComponent> = {\n [RangeSchemaType.NUMBER]: FormFieldComponent.RANGE_SLIDER,\n [RangeSchemaType.DATE]: FormFieldComponent.DATE_RANGE,\n [RangeSchemaType.DATETIME]: FormFieldComponent.DATETIME_RANGE,\n [RangeSchemaType.TIME]: FormFieldComponent.TIME_RANGE,\n [RangeSchemaType.BIGDECIMAL]: FormFieldComponent.BIGDECIMAL_RANGE,\n [RangeSchemaType.MONEY]: FormFieldComponent.MONEY_RANGE,\n};\n\n// Get the default form component for a range type.\nexport function getDefaultRangeComponent(rangeType: RangeSchemaType | string): FormFieldComponent {\n return RangeTypeToComponent[rangeType as RangeSchemaType] ?? FormFieldComponent.RANGE_SLIDER;\n}\n\n\n/**\n * Inferred type for a range schema based on options.\n */\nexport type RangeSchemaInferredType<\n T extends RangeType,\n FromOptional extends boolean = true,\n ToOptional extends boolean = true\n> = {\n from: FromOptional extends true ? RangeTypeMapping[T] | undefined : RangeTypeMapping[T];\n to: ToOptional extends true ? RangeTypeMapping[T] | undefined : RangeTypeMapping[T];\n};\n\n//------------------------------------------------------------------------------------------------\n// MONEY SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Metadata stored on money schemas for detection and configuration.\n * Money schemas represent financial amounts with bigint storage to avoid precision issues.\n * Structure: { amount: bigint, currency: string, decimals: number (int) }\n */\nexport interface MoneySchemaMetadata {\n /** Marker for detecting money schemas */\n isMoney: true;\n /**\n * Currency category filter. Replaces old `showCrypto` / `majorOnly` / `fiatOnly` booleans.\n * E.g. `[CurrencyAllowed.FIAT]` = fiat only, `[CurrencyAllowed.FIAT_MAJOR]` = major fiat only.\n * When undefined or empty, all currencies are available.\n */\n currenciesAllowed?: CurrencyAllowed[];\n /** Whether to show only app-enabled currencies (default: true). Renamed from `enabledOnly`. */\n appEnabledOnly?: boolean;\n /** Whether to allow currency change (default: true) */\n allowCurrencyChange?: boolean;\n /** Minimum amount in smallest unit as bigint (e.g., 0n for non-negative) */\n minAmount?: bigint;\n /** Maximum amount in smallest unit as bigint */\n maxAmount?: bigint;\n}\n\n/**\n * Options for creating a money schema.\n */\nexport interface MoneySchemaOptions {\n /**\n * Currency category filter. Replaces old `showCrypto` / `majorOnly` / `fiatOnly` booleans.\n * E.g. `[CurrencyAllowed.FIAT]` = fiat only, `[CurrencyAllowed.FIAT_MAJOR]` = major fiat only.\n * When undefined or empty, all currencies are available.\n */\n currenciesAllowed?: CurrencyAllowed[];\n /** Whether to show only app-enabled currencies (default: true). Renamed from `enabledOnly`. */\n appEnabledOnly?: boolean;\n /** Whether to allow currency change (default: true) */\n allowCurrencyChange?: boolean;\n /** Minimum amount in smallest unit as bigint (e.g., 0n for non-negative) */\n minAmount?: bigint;\n /** Maximum amount in smallest unit as bigint */\n maxAmount?: bigint;\n}\n\n//------------------------------------------------------------------------------------------------\n// BIGDECIMAL SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Metadata stored on bigdecimal schemas for detection and configuration.\n * BigDecimal schemas represent precise decimal numbers stored as strings.\n * Uses big.js for precise arithmetic operations.\n */\nexport interface BigDecimalSchemaMetadata {\n /** Marker for detecting bigdecimal schemas */\n isBigDecimal: true;\n /** Maximum number of decimal places allowed */\n precision?: number;\n /** Minimum value (as string for precision) */\n min?: string;\n /** Maximum value (as string for precision) */\n max?: string;\n}\n\n/**\n * Options for creating a bigdecimal schema.\n */\nexport interface BigDecimalSchemaOptions {\n /** Maximum number of decimal places allowed */\n precision?: number;\n /** Minimum value (as string for precision) */\n min?: string;\n /** Maximum value (as string for precision) */\n max?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// DURATION SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Duration units enum.\n * Uses string values for JSON serialization and API compatibility.\n * Aligns with common patterns (e.g., expiresIn: { value, unit }).\n */\nexport enum DurationUnit {\n MILLISECONDS = 'milliseconds',\n SECONDS = 'seconds',\n MINUTES = 'minutes',\n HOURS = 'hours',\n DAYS = 'days',\n WEEKS = 'weeks',\n MONTHS = 'months',\n YEARS = 'years',\n CENTURIES = 'centuries',\n}\n\n/**\n * Token expiry duration — minutes, hours, or days only.\n * Structurally compatible with DurationValue. Use ExpiresInDurationSchema for validation.\n */\nexport type ExpiresInDuration = {\n value: number;\n unit: DurationUnit.MINUTES | DurationUnit.HOURS | DurationUnit.DAYS;\n};\n\n/**\n * Metadata stored on duration schemas for detection and configuration.\n * Duration schemas represent time spans with { value: number, unit: DurationUnit }.\n */\nexport interface DurationSchemaMetadata {\n /** Marker for detecting duration schemas */\n isDuration: true;\n /** Allowed units (if empty/undefined, all units are allowed) */\n allowedUnits?: DurationUnit[];\n /** Minimum value (for the numeric part) */\n minValue?: number;\n /** Maximum value (for the numeric part) */\n maxValue?: number;\n}\n\n//------------------------------------------------------------------------------------------------\n// PHONE SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * ISO 3166-1 alpha-2 country code (e.g., 'US', 'FR').\n *\n * Narrowed to libphonenumber's `CountryCode` union (not a bare `string`) so an\n * invalid code fails at COMPILE time. The runtime consequence of a bad code is\n * a throw from `getCountryCallingCode` — and since the international phone\n * edit control renders the selected dial code, an invalid authored\n * `defaultCountry` would crash the form at first render, not merely misparse.\n */\nexport type PhoneCountryCode = LibPhoneNumberCountryCode;\n\n/**\n * Metadata stored on phone schemas for detection and configuration.\n * Phone schemas store E.164 strings.\n */\nexport interface PhoneSchemaMetadata {\n /** Marker for detecting phone schemas */\n isPhone: true;\n /** Default country when parsing numbers without country code */\n defaultCountry?: PhoneCountryCode;\n}\n\n/**\n * Options for creating a phone schema via z_phone().\n */\nexport interface PhoneSchemaOptions {\n /** Default country when parsing numbers without country code */\n defaultCountry?: PhoneCountryCode;\n}\n\n//------------------------------------------------------------------------------------------------\n// CODE SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Supported code/programming languages for code schemas.\n */\nexport type CodeLanguage =\n | 'javascript' | 'typescript' | 'python' | 'java' | 'csharp' | 'cpp' | 'c'\n | 'go' | 'rust' | 'ruby' | 'php' | 'swift' | 'kotlin' | 'scala'\n | 'html' | 'css' | 'scss' | 'less' | 'json' | 'yaml' | 'xml' | 'markdown'\n | 'sql' | 'graphql' | 'bash' | 'shell' | 'powershell'\n | 'dockerfile' | 'nginx' | 'apache'\n | 'plaintext' | string;\n\n/**\n * Metadata stored on code schemas for detection and configuration.\n * Code schemas represent code snippets with language information.\n * Structure: { content: string, language: string }\n */\nexport interface CodeSchemaMetadata {\n /** Marker for detecting code schemas */\n isCode: true;\n /** Allowed languages (if empty, all languages are allowed) */\n allowedLanguages?: CodeLanguage[];\n /** Maximum content length in characters */\n maxLength?: number;\n /** Minimum content length in characters */\n minLength?: number;\n}\n\n\n\n/**\n * Options for creating a code schema.\n */\nexport interface CodeSchemaOptions {\n /** Allowed languages (if empty, all languages are allowed) */\n allowedLanguages?: CodeLanguage[];\n /** Maximum content length in characters */\n maxLength?: number;\n /** Minimum content length in characters */\n minLength?: number;\n}\n\n//------------------------------------------------------------------------------------------------\n// FILE SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Common MIME type groups for file uploads.\n */\nexport const FileMimeTypeGroups = {\n /** Image files: JPEG, PNG, GIF, WebP, SVG, etc. */\n Images: [\n 'image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml',\n 'image/bmp', 'image/tiff', 'image/x-icon', 'image/heic', 'image/heif'\n ],\n /** Video files: MP4, WebM, AVI, MOV, etc. */\n Video: [\n 'video/mp4', 'video/webm', 'video/ogg', 'video/avi', 'video/quicktime',\n 'video/x-msvideo', 'video/x-ms-wmv', 'video/mpeg', 'video/3gpp'\n ],\n /** Audio files: MP3, WAV, OGG, etc. */\n Audio: [\n 'audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/webm', 'audio/aac',\n 'audio/flac', 'audio/x-m4a', 'audio/mp4'\n ],\n /** PDF documents */\n PDF: ['application/pdf'],\n /** Office documents: Word, Excel, PowerPoint, etc. */\n Office: [\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/vnd.ms-excel',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/vnd.ms-powerpoint',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'application/vnd.oasis.opendocument.text',\n 'application/vnd.oasis.opendocument.spreadsheet',\n 'application/vnd.oasis.opendocument.presentation'\n ],\n /** All documents: PDF + Office */\n Documents: [\n 'application/pdf',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/vnd.ms-excel',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/vnd.ms-powerpoint',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'application/vnd.oasis.opendocument.text',\n 'application/vnd.oasis.opendocument.spreadsheet',\n 'application/vnd.oasis.opendocument.presentation'\n ],\n /** Archives: ZIP, RAR, 7z, etc. */\n Archives: [\n 'application/zip', 'application/x-zip-compressed',\n 'application/x-rar-compressed', 'application/x-7z-compressed',\n 'application/gzip', 'application/x-tar'\n ],\n} as const;\n\nexport type FileMimeTypeGroup = keyof typeof FileMimeTypeGroups;\n\n/**\n * @wildo_source:part:start zod.decorators.file-vocabularies facet:layer:shared facet:audience:app-developer\n *\n * The vocabularies a `z_file()` field selects from. Pick a member of each; the option bag names the\n * type, and these are the values.\n *\n * File nature classification, chosen with `z_file({ nature })`. It selects which per-nature\n * constraint bag applies and how the form control and display surface behave. `ALL` accepts any\n * kind and is the right answer for a generic attachment field.\n */\nexport enum FileNature {\n IMAGE = 'image',\n VIDEO = 'video',\n AUDIO = 'audio',\n PDF = 'pdf',\n OFFICE = 'office',\n ARCHIVE = 'archive',\n ALL = 'all',\n}\n/** @wildo_source:part:end zod.decorators.file-vocabularies */\n\n/**\n * Rendering-level file nature categories.\n *\n * Maps the granular `FileNature` schema enum into coarser display categories\n * used by frontend components to select the appropriate renderer:\n * - `FileNature.PDF` + `FileNature.OFFICE` → `FileDisplayNature.DOCUMENT`\n * - `FileNature.ARCHIVE` + `FileNature.ALL` + unknown → `FileDisplayNature.GENERIC`\n *\n * Use `resolveFileDisplayNature()` from `zod-file.ts` to resolve from\n * schema metadata and/or MIME type.\n */\nexport enum FileDisplayNature {\n IMAGE = 'image',\n VIDEO = 'video',\n AUDIO = 'audio',\n DOCUMENT = 'document',\n GENERIC = 'generic',\n}\n\n/**\n * Frame shape for an inline media (image) preview — see `FileUIDisplayParams.preview`.\n * - `ROUNDED` (default): rounded-corner rectangle, aspect preserved (`object-contain`).\n * - `SQUARE`: sharp-corner rectangle, aspect preserved.\n * - `CIRCLE`: circular frame; the image is cropped to fill (`object-cover`). Typical\n * for avatars / profile pictures.\n */\nexport enum FileMediaShape {\n ROUNDED = 'rounded',\n SQUARE = 'square',\n CIRCLE = 'circle',\n}\n\n/**\n * Rendered size tier for an inline media (image) preview — see\n * `FileUIDisplayParams.preview`. `XS`–`XL` are fixed dimensions (a `CIRCLE` uses the\n * value as its diameter; a rectangle uses it as the max width). `FULL` fills the\n * available column width (the default, container-responsive) — best for cover images,\n * not avatars.\n */\nexport enum FileMediaSize {\n XS = 'xs',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n FULL = 'full',\n}\n\n/**\n * How a file field renders AT REST, before any interaction — one of the two\n * orthogonal axes of the file display policy (the other is\n * {@link FileActivationPolicy}, what a click does).\n *\n * - `CARD` (default): the neutral file card — icon + filename + size. Compact and\n * nature-agnostic, so a detail view holding several documents stays scannable.\n * - `THUMBNAIL`: a small rendered preview of the media beside the title (an image\n * thumbnail, a PDF's rasterised first page). Informative but still compact.\n * - `FULL`: the media rendered inline at full width — an image, a video player, a\n * paginated PDF viewer. The heaviest option: for documents it downloads and mounts\n * the viewer on first paint, so prefer `CARD` + an `OVERLAY` activation unless the\n * document IS the page.\n *\n * `THUMBNAIL` and `FULL` require a displayer for the file's resolved nature; a\n * request the nature cannot satisfy is refused at registry build (narrow declared\n * nature) or degraded to `CARD` at runtime (open nature) — never a broken render.\n */\nexport enum FileDisplayPresentation {\n CARD = 'card',\n THUMBNAIL = 'thumbnail',\n FULL = 'full',\n}\n\n/**\n * What activating (clicking / Enter) a displayed file does — the second axis of the\n * file display policy. Applies to EVERY file nature, not just images.\n *\n * - `NONE`: inert. No cursor affordance, no handler, not focusable as a control.\n * - `OVERLAY`: open the nature's displayer in an overlay (the generalisation of the\n * old image-only lightbox). Requires a displayer for the resolved nature.\n * - `DOWNLOAD`: fetch the bytes over the authenticated serve route and save them.\n * - `NEW_TAB`: open the authenticated serve URL in a new tab (the browser's own\n * viewer, with its native print/save affordances).\n * - `CUSTOM`: run an operation declared on the resource that OWNS this file field —\n * see {@link FileActivationConfig}.\n */\nexport enum FileActivationPolicy {\n NONE = 'none',\n OVERLAY = 'overlay',\n DOWNLOAD = 'download',\n NEW_TAB = 'new_tab',\n CUSTOM = 'custom',\n}\n\n/**\n * The authored activation, discriminated on `policy`.\n *\n * `CUSTOM` names an operation **by identifier**, never a callback. The reference is\n * resolved against the resource that owns the file field, so the click inherits that\n * operation's entire contract for free — `roles` authorization, `enabledCondition`,\n * i18n label/tooltip, icon, risk level and audit emission — none of which a raw\n * handler could carry. It also keeps display config serializable, which the\n * specification layer, the companion and i18n generation all depend on.\n *\n * Dispatch follows the referenced operation's own frontend surface: `ADDRESSABLE`\n * navigates, `EMBEDDED` opens in the overlay host, `API_ONLY` executes directly\n * (with the standard confirmation for critical operations). The clicked file travels\n * to the operation as context (`{ fieldName, fileId }`); the operation targets the\n * owning row. An unresolvable reference fails at registry build, never as a dead control.\n *\n * @example\n * // Click the attachment card to run the owning resource's `send_to_dms` operation.\n * { policy: FileActivationPolicy.CUSTOM, operationIdentifier: 'send_to_dms' }\n */\nexport type FileActivationConfig =\n | {\n policy:\n | FileActivationPolicy.NONE\n | FileActivationPolicy.OVERLAY\n | FileActivationPolicy.DOWNLOAD\n | FileActivationPolicy.NEW_TAB;\n }\n | {\n policy: FileActivationPolicy.CUSTOM;\n /** Operation identifier declared on the resource owning this file field. */\n operationIdentifier: string;\n /** Disambiguates when the operation has several keyed variants. */\n variantKey?: string;\n };\n\n/**\n * Presentation detail for a rendered media preview. Applies when\n * {@link FileUIDisplayParams.presentation} is `THUMBNAIL` or `FULL`; ignored by `CARD`.\n * All fields are optional with sensible defaults (rounded rectangle, full width,\n * caption on). An avatar typically sets `{ shape: CIRCLE, size: MD, showCaption: false }`.\n *\n * Click behaviour is NOT here — it is the separate `activation` axis, so that every\n * nature (not only images) can express it.\n */\nexport interface FileMediaPreviewOptions {\n /** Frame shape. @default FileMediaShape.ROUNDED */\n shape?: FileMediaShape;\n /** Rendered size tier. @default FileMediaSize.FULL */\n size?: FileMediaSize;\n /** Show the caption row (filename / size / dimensions / download) under the media. @default true */\n showCaption?: boolean;\n}\n\n/**\n * @wildo_source:part:start zod.decorators.file-vocabularies\n *\n * Where a field's bytes may be stored, chosen with `z_file({ storageAccepted: [...] })`. ORDER\n * EXPRESSES PREFERENCE: list several and the first CONFIGURED one is used. Omit the option entirely\n * and the field resolves to managed storage.\n *\n * ⚠️ **Only `WILDO_MANAGED` and `LOCAL_DIRECTORY` have a provider behind them.** `ONEDRIVE`,\n * `GOOGLE_DRIVE` and `DROPBOX` are declared vocabulary with no implementation — a field naming only\n * those has no configured provider, and startup configuration validation refuses the application\n * rather than letting it serve a field that could never accept an upload.\n *\n * ⚠️ **The target is decided once, when the file is created, and the object never moves.** Changing\n * a field's declared target changes where NEW files go; it does not relocate what is already stored.\n */\nexport enum FileStorageAccepted {\n WILDO_MANAGED = 'wildo_managed',\n LOCAL_DIRECTORY = 'local_directory',\n ONEDRIVE = 'onedrive',\n GOOGLE_DRIVE = 'google_drive',\n DROPBOX = 'dropbox',\n}\n/** @wildo_source:part:end zod.decorators.file-vocabularies */\n\n/**\n * Context object passed to `FilePathBinding` resolver functions.\n *\n * `relatedObject` may be undefined for standalone uploads (no parent resource).\n * `fileMetadata` and `applicationId` are always provided by the runtime.\n */\nexport interface FilePathBindingContext {\n /** The parent resource instance (undefined for standalone uploads) */\n relatedObject?: Record<string, unknown>;\n /** The z_file() field's schema metadata */\n fileMetadata: FileSchemaMetadata;\n /** Application identifier from the execution context */\n applicationId: string;\n}\n\n/**\n * Policy for `z_file({ multiple: true })` fields.\n *\n * Controls the intermediary subfolder name and individual file naming\n * when several files live under the same instance folder.\n */\nexport interface FileMultipleFilePolicy {\n /**\n * Subfolder name under the resolved folder path.\n * Defaults to the field name when omitted.\n * @example 'personnas'\n */\n subfolder?: string;\n\n /**\n * Determines the individual file name for each upload.\n *\n * - `string` — template with placeholders:\n * `{field}`, `{ts}`, `{uuid}`, `{ext}`, `{original}`\n * - `function` — full control, receives context + file-level info\n *\n * @default '{field}_{ts}_{uuid}.{ext}'\n */\n fileNameTemplate?: string | ((\n context: FilePathBindingContext,\n fileInfo: { fileId: string; fieldName: string; originalFileName?: string },\n ) => string);\n}\n\n/**\n * File path binding configuration authored on `z_file()`.\n *\n * Declares how files for a given field are located in path-based\n * storage backends. The binding is backend-agnostic: it affects the\n * S3 key prefix for managed storage and the filesystem path for\n * local-directory storage alike.\n *\n * ## Path composition\n *\n * ```\n * <provider root>/\n * applications/<applicationId>/files/ ← unless includeApplicationId is false\n * <storageName>/ ← the linked resource's collection, else `_unlinked`\n * <scope>/<scopeId>/ ← the tenant segments (organizations/<id>, user_self/<id>,\n * or application/<applicationId>)\n * [folderPath(ctx)/] ← dynamic folder path\n * <fileName(ctx) | fileId> ← explicit name or UUID fallback\n * ```\n *\n * Only the last two lines are authored here. Everything above them is derived by the framework and\n * is identical on every path-based provider, because `<scope>/<scopeId>` is what makes one tenant's\n * blobs a PREFIX — the unit erasure, orphan sweeps and per-tenant listing operate on.\n *\n * When nothing is configured, the leaf is the `{fileId}` UUID.\n *\n * @example\n * ```typescript\n * z_file({\n * filePathBinding: {\n * folderPath: (ctx) => `specs/icps/${ctx.relatedObject?.name}`,\n * fileName: 'personna.md',\n * },\n * })\n * ```\n *\n * @example\n * ```typescript\n * z_file({\n * multiple: true,\n * filePathBinding: {\n * folderPath: (ctx) => `specs/icps/${ctx.relatedObject?.name}`,\n * multipleFilePolicy: {\n * subfolder: 'personnas',\n * fileNameTemplate: '{field}_{ts}_{uuid}.{ext}',\n * },\n * },\n * })\n * ```\n */\nexport interface FilePathBinding {\n /**\n * Determines the folder path relative to the provider's root.\n *\n * - `string` — static path, forward-slash separated.\n * - `function` — receives the binding context and returns the path.\n * The function has access to the related resource object, file metadata,\n * and the applicationId.\n *\n * Forward-slash separated, no leading or trailing slash.\n * @example 'specs/icps'\n * @example (ctx) => `specs/icps/${slugify(ctx.relatedObject?.name)}`\n */\n folderPath?: string | ((context: FilePathBindingContext) => string);\n\n /**\n * File name for single `z_file()` fields (non-multiple).\n * When omitted, falls back to the fileId (UUID-based, legacy behavior).\n *\n * - `string` — static name; can include `{ext}` placeholder.\n * - `function` — receives binding context and returns the file name.\n *\n * @example 'personna.md'\n * @example 'avatar.{ext}'\n * @example (ctx) => `${ctx.relatedObject?.slug}.md`\n */\n fileName?: string | ((context: FilePathBindingContext) => string);\n\n /**\n * Naming policy for `z_file({ multiple: true })` fields.\n * Controls the intermediary subfolder and individual file naming.\n */\n multipleFilePolicy?: FileMultipleFilePolicy;\n\n /**\n * Whether the framework-derived prefix — `applications/<appId>/files/<storageName>/<scope>/<scopeId>/`\n * — is placed above the authored `folderPath` / `fileName`.\n *\n * Defaults to `true` on EVERY provider. It used to default to `false` for `local_directory`\n * (\"the volume is typically per-app\"), and that is what left local-directory deployments with no\n * tenant structure at all: a per-app volume separates applications from one another and separates\n * nothing inside one.\n *\n * Setting it to `false` collapses the key to the bare `[folderPath/]<fileName|fileId>` on every\n * provider. That discards the whole prefix, not merely the application segment — so erasure,\n * orphan sweeps, per-tenant listing and credential confinement all stop being expressible for\n * that field. Author it only for a store whose layout is fixed by something outside Wildo.\n */\n includeApplicationId?: boolean;\n}\n\nexport enum FileUploaderEntityType {\n USER = 'user',\n ANONYMOUS_USER = 'anonymous_user',\n // Machine (non-human) uploaders. The value is the PRINCIPAL kind (org/app machine), NOT the\n // credential kind — an api-key AND an OAuth client both authenticate the same machine principal,\n // and the specific credential (api-key vs OAuth client) + its id are recorded on\n // `initiatorIds.machineCredential` (authMethod + credentialId). Keeping this enum principal-keyed\n // (matching USER / ANONYMOUS_USER) avoids mislabelling an OAuth-client upload as an \"api key\".\n ORGANIZATION_MACHINE = 'organization_machine',\n APPLICATION_MACHINE = 'application_machine',\n}\n\nexport type FileUploaderOwnership =\n | {\n uploadedBy: string;\n uploadedByEntityType: FileUploaderEntityType;\n }\n | {\n uploadedBy?: undefined;\n uploadedByEntityType?: undefined;\n };\n\n/**\n * Image format options for file validation.\n */\nexport const ImageFormat = {\n JPEG: 'jpeg',\n PNG: 'png',\n GIF: 'gif',\n WEBP: 'webp',\n SVG: 'svg',\n} as const;\nexport type ImageFormat = typeof ImageFormat[keyof typeof ImageFormat];\n\n/**\n * Video format options for file validation.\n */\nexport const VideoFormat = {\n MP4: 'mp4',\n WEBM: 'webm',\n MOV: 'mov',\n} as const;\nexport type VideoFormat = typeof VideoFormat[keyof typeof VideoFormat];\n\n/**\n * Audio format options for file validation.\n */\nexport const AudioFormat = {\n MP3: 'mp3',\n WAV: 'wav',\n OGG: 'ogg',\n AAC: 'aac',\n} as const;\nexport type AudioFormat = typeof AudioFormat[keyof typeof AudioFormat];\n\n/**\n * @wildo_source:part:start zod.decorators.file-nature-constraints facet:layer:shared facet:audience:app-developer\n *\n * The per-NATURE constraint bags a `z_file()` field may carry — one per media kind, selected by the\n * field's `nature`. `imageConstraints`, `videoConstraints`, `audioConstraints` and\n * `documentConstraints` on the `z_file()` options each take the matching interface below.\n *\n * ⚠️ **A constraint describes what the FIELD ACCEPTS, not what the bytes ARE.** The media type comes\n * from the upload's declared content type; nothing here decodes the file to confirm that something\n * claiming to be an image is one. Treat these as an authoring contract and a form control's\n * behaviour, not as a security boundary — the defence against a mislabelled file is on the SERVING\n * side, where every response carries a no-sniff header and a restrictive content policy.\n *\n * ⚠️ **`generateThumbnails` (image, PLURAL) and `generateThumbnail` (video, SINGULAR) are different\n * options on different bags.** The names differ by one letter and do not behave alike; read each\n * one's own note below rather than assuming the image semantics carry over.\n *\n * Image-specific constraints for file validation.\n */\nexport interface FileNatureConstraints_Image {\n minWidth?: number;\n maxWidth?: number;\n minHeight?: number;\n maxHeight?: number;\n aspectRatio?: { width: number; height: number };\n allowedFormats?: ImageFormat[];\n /**\n * May the serve path derive a downscaled preview rendition of this image?\n *\n * **Opt-OUT, and absence means PERMIT.** Omitting it, or setting `true`, lets `?variant=thumbnail`\n * return a rendition. Setting it **`false` REFUSES** that request — it does not quietly serve the\n * original bytes, which is what every other ineligible case does and what an author suppressing\n * renditions for cost or privacy is trying to avoid. A caller wanting the image anyway asks for\n * the original variant explicitly.\n *\n * The `{ sizes: [...] }` form reads as permission and **its sizes are not honoured**: the\n * derivation has one fixed longest edge. Do not author sizes expecting them to reach the renderer.\n *\n * Wired 2026-09-08 (#477's sibling, #478). Before that this flag was declared, set on the\n * framework's own user-avatar field, and read by nothing — so it degraded permissively: an author\n * who set it `false` still got thumbnails, and got no error saying so.\n */\n generateThumbnails?: boolean | { sizes: { width: number; height: number }[] };\n}\n\n/**\n * Video-specific constraints for file validation.\n */\nexport interface FileNatureConstraints_Video {\n maxDuration?: number; // seconds\n minDuration?: number;\n allowedFormats?: VideoFormat[];\n generateThumbnail?: boolean;\n}\n\n/**\n * Audio-specific constraints for file validation.\n */\nexport interface FileNatureConstraints_Audio {\n maxDuration?: number;\n minDuration?: number;\n allowedFormats?: AudioFormat[];\n}\n\n/**\n * Document-specific constraints for file validation.\n */\nexport interface FileNatureConstraints_Document {\n maxPages?: number;\n minPages?: number;\n}\n/** @wildo_source:part:end zod.decorators.file-nature-constraints */\n\n/*\n * MAINTAINER NOTE — deliberately OUTSIDE the `zod.decorators.rag-source` anchor below, because the\n * anchor ships into every generated application and an application author needs the vocabulary, not\n * its history. The one sentence they DO need (\"there is no semantic member, and why\") is inside.\n *\n * ## `SEMANTIC` was a fifth member here, and was REMOVED on 2026-09-09 (#434)\n *\n * It read `SEMANTIC — split at embedding-detected topic boundaries` and was never implemented: every\n * field authoring it silently degraded to `FIXED_SIZE`. The obvious fix was to build it. The measured\n * answer is that it is not worth building, so the member went instead — recorded because \"add the\n * missing one back\" is what the next reader will otherwise propose.\n *\n * Chroma's chunking evaluation benchmarks exactly this algorithm. Its `KamradtSemanticChunker` scored\n * 83.6% recall / 1.5% precision against `RecursiveCharacterTextSplitter`'s 89.5% / 3.6% — worse on\n * BOTH axes than the `RECURSIVE` member beside it — and the report calls it \"slightly below average\n * across all metrics\". A 2026 cost-versus-effectiveness study reached the same conclusion\n * independently: expensive chunking methods \"do not yield meaningful effectiveness improvements while\n * introducing substantially higher computational overhead\", with only fixed-size and recursive\n * \"robust across datasets\".\n * spec-cite: Chroma, \"Evaluating Chunking Strategies for Retrieval\"\n * (https://www.trychroma.com/research/evaluating-chunking); arXiv:2606.00881. Both read 2026-09-09.\n *\n * The architectural cost was the other half, and it is Wildo-specific. Boundaries computed from\n * embeddings make the CHUNKER a client of the embeddings provider on the resource WRITE path, and\n * force the embedding model into `chunkingConfigHash` — after which a model migration RE-CHUNKS\n * rather than re-embedding in place, discarding exactly the property the dimension-flexible vector\n * column and the deferred `rag:embedding-drain` batch exist to provide.\n *\n * If retrieval quality is ever the MEASURED bottleneck, the evidence points at CONTEXTUAL RETRIEVAL\n * (prepend document-level context to each chunk before embedding), not at topic boundaries. That\n * changes what is embedded rather than when boundaries are computed, so it costs none of the above.\n */\n/**\n * @wildo_source:part:start zod.decorators.rag-source facet:layer:shared facet:family:decorator facet:family:param-surface facet:kind:api facet:audience:app-developer\n *\n * How a RAG-source field's text is split into retrieval chunks.\n *\n * Import from `@wildo-ai/zod-decorators`. Every member is a chunking STRATEGY — pick the one that\n * matches the field's real content shape, because chunk boundaries decide what a retrieval hit can\n * quote: a heading-aware split over markdown returns a coherent section, while a fixed-size split\n * over the same text returns whatever fell inside the window.\n *\n * **This is the single named home for the chunking vocabulary** (semantic-string-literals rule).\n * It lives in `zod-decorators` — not `saas-models` — because the dependency arrow points the other\n * way: `saas-models` depends on this package, while the `.ragSource()` decorator params below could\n * never import a `saas-models` enum. Chunking is authored ON THE FIELD, through `.ragSource()`;\n * there is no separate agent-level chunking configuration to keep in step with it.\n *\n * - `FIXED_SIZE` — split every `chunkSize` characters/tokens regardless of structure.\n * - `RECURSIVE` — split on a separator hierarchy (paragraph → sentence → word) down to `chunkSize`.\n * - `MARKDOWN` — split on markdown structure (headings, lists, code fences).\n * - `CODE` — split on source-code structure (functions, classes, blocks). Unified in (2026-08-26)\n * from a second copy of this vocabulary that `saas-models` then carried: the member sets differed\n * only by this entry, and shrinking the vocabulary to fit the field decorator would have silently\n * invalidated configurations authored against the wider one — so the union won. That second copy,\n * and the agent-level RAG configuration schemas around it, were retired on 2026-08-27 as a\n * pre-capability design the shipped capability superseded; this object is now the only home.\n *\n * There is deliberately NO semantic/embedding-based member. It is the option people reach for\n * first, and published evaluations put it BELOW `RECURSIVE` on both recall and precision while\n * costing an embedding pass per document — so `RECURSIVE` is the right default for prose, and the\n * two structure-aware members are for text whose structure carries meaning.\n *\n */\nexport const RAGChunkingStrategy = {\n FIXED_SIZE: 'fixed_size',\n RECURSIVE: 'recursive',\n MARKDOWN: 'markdown',\n CODE: 'code',\n} as const;\nexport type RAGChunkingStrategy = typeof RAGChunkingStrategy[keyof typeof RAGChunkingStrategy];\n\n/**\n * Stored metadata for the RAG-source declaration (`.ragSource()` / `addRagSource()` /\n * `z_file({ ragSource })`).\n *\n * Every knob is optional — `z.string().ragSource()` is a complete declaration that accepts the\n * framework chunking defaults — and there is deliberately NO `enabled` flag: a field either carries\n * the decorator (it IS a retrieval-corpus source) or it does not. A boolean that could say\n * \"decorated but disabled\" would make every downstream reader (detection, chunk store, erasure\n * seams) re-ask a question the decorator's presence already answers.\n *\n * Validated at decoration time by the `applySingleDecorator` chokepoint (shared by the fluent\n * method and the escape hatch): `chunkingStrategy` must be a {@link RAGChunkingStrategy} member,\n * `chunkSize` a positive integer, `chunkOverlap` a non-negative integer strictly smaller than\n * `chunkSize` when both are present. Read the stored config back with `getRagSourceConfig(schema)`.\n *\n * Note the split of concerns with file fields: this object configures CHUNKING — how text becomes\n * retrieval chunks — and is identical for a plain string field and a file field. How the TEXT is\n * OBTAINED in the first place is the text provider's concern: trivial for a string field (the value\n * is the text), file-side config for a file field (`FileSchemaOptions.textExtraction`, e.g. OCR).\n */\nexport interface RagSourceConfiguration {\n /** Chunking strategy for this field's text. Omitted = the framework default strategy. */\n chunkingStrategy?: RAGChunkingStrategy;\n /** Target chunk size. Positive integer; omitted = the strategy's default size. */\n chunkSize?: number;\n /** Overlap carried between consecutive chunks. Non-negative integer, `< chunkSize` when both are set. */\n chunkOverlap?: number;\n}\n/** @wildo_source:part:end zod.decorators.rag-source */\n\n/**\n * @wildo_source:part:start zod.decorators.file-generation facet:layer:schema facet:family:pdf-templates\n *\n * Generation sources supported by `z_file()`.\n *\n * Keep this enum in `zod-decorators` instead of `saas-models` so shared schemas\n * can mark generated files without creating a dependency cycle back into the\n * resource/model packages that already consume decorators.\n */\nexport enum FileGenerationSource {\n PDF_TEMPLATE = 'pdfTemplate',\n}\n\n/**\n * Frontend-safe file generation metadata.\n *\n * This is deliberately a stable identifier only. The backend binds that\n * identifier to an imported `PdfTemplateDefinition` during application startup,\n * which keeps live functions and React components out of shared schema metadata.\n */\nexport interface FileGenerationConfig {\n /** The generation system responsible for materializing the file value. */\n source: FileGenerationSource.PDF_TEMPLATE;\n /** Stable id of the backend-bound PDF template definition. */\n templateId: string;\n}\n/** @wildo_source:part:end zod.decorators.file-generation */\n\n/**\n * File metadata returned by the getMetadata endpoint.\n * This describes the uploaded file's properties.\n */\nexport type FileMetadata = {\n /** Unique file identifier */\n fileId: string;\n /** Original filename */\n filename: string;\n /** File size in bytes */\n size: number;\n /** MIME type */\n mimeType: string;\n /** File extension (without dot) */\n extension?: string;\n /** File checksum/hash for integrity */\n checksum?: string;\n /** URL to access/download the file */\n url?: string;\n /** URL to thumbnail (for images/videos) */\n thumbnailUrl?: string;\n /** Display nature category (image, video, audio, document, generic) */\n nature?: FileDisplayNature;\n /** Image width in pixels (for images) */\n width?: number;\n /** Image height in pixels (for images) */\n height?: number;\n /** Duration in seconds (for video/audio) */\n duration?: number;\n /** Page count (for documents) */\n pageCount?: number;\n /** Upload timestamp */\n uploadedAt: Date;\n} & FileUploaderOwnership;\n\n/**\n * @wildo_source:part:start zod.decorators.file-vocabularies\n *\n * What happens to the file when its parent record is deleted, chosen with\n * `z_file({ onParentDelete })`. Defaults to `CASCADE`.\n *\n * ⚠️ `SOFT_DELETE` behaves IDENTICALLY to `CASCADE` at runtime today. It exists as an explicit\n * semantic marker for consumers that want to model a softer intent — choosing it does not currently\n * change what happens to the file.\n *\n * File behavior when parent resource is deleted.\n * - CASCADE: Mark the file deleted as part of parent removal; physical storage cleanup is deferred to the cleanup batch\n * - SOFT_DELETE: Same current runtime behavior as CASCADE, but keeps an explicit semantic marker for consumers that want to model softer intent\n * - ORPHAN: Keep file, remove association with parent\n */\nexport const FileOnParentDelete = {\n CASCADE: 'cascade',\n SOFT_DELETE: 'soft-delete',\n ORPHAN: 'orphan',\n} as const;\nexport type FileOnParentDelete = typeof FileOnParentDelete[keyof typeof FileOnParentDelete];\n/** @wildo_source:part:end zod.decorators.file-vocabularies */\n\n/**\n * @wildo_source:part:start zod.decorators.file-schema\n *\n * Metadata stored on file schemas for detection and configuration.\n * File schemas represent file references with upload capabilities.\n * Structure (single): { fileId: string, updatedAt: Date }\n * Structure (multiple): { fileIds: string[], updatedAt: Date }\n */\nexport interface FileSchemaMetadata {\n /** Marker for detecting file schemas */\n isFile: true;\n /** Whether existing files can be replaced/overridden (default: true) */\n overridable?: boolean;\n /** Allowed MIME types (if empty, all types are allowed) */\n allowedMimeTypes?: string[];\n /** Maximum file size in bytes */\n maxSize?: number;\n /** Minimum file size in bytes */\n minSize?: number;\n /** Whether multiple files can be uploaded (default: false) */\n multiple?: boolean;\n /** Maximum number of files (when multiple is true) */\n maxFiles?: number;\n /** File nature classification */\n nature?: FileNature;\n /** Storage providers accepted for file uploads */\n storageAccepted?: FileStorageAccepted[];\n /** File path binding for structured storage organization */\n filePathBinding?: FilePathBinding;\n /**\n * Generation metadata for files materialized by framework operations instead\n * of user uploads. Generated file fields are readable but omitted from write\n * DTOs by downstream resource tooling.\n */\n generation?: FileGenerationConfig;\n /** Image-specific constraints */\n imageConstraints?: FileNatureConstraints_Image;\n /** Video-specific constraints */\n videoConstraints?: FileNatureConstraints_Video;\n /** Audio-specific constraints */\n audioConstraints?: FileNatureConstraints_Audio;\n /** Document-specific constraints */\n documentConstraints?: FileNatureConstraints_Document;\n /**\n * Text-provider configuration for this file field — HOW text is obtained from the file's bytes\n * when something needs it (today: RAG chunking of a `ragSource` file field; the standalone\n * text-extraction operation reads it too).\n *\n * Deliberately file-side and separate from {@link RagSourceConfiguration}: extraction is a\n * property of the FILE FIELD (its bytes need decoding — PDF parsing, OCR), while chunking is the\n * shared RAG-source concern a plain string field carries identically. The former `extractText`\n * boolean is gone with `z_file({ rag })`: for a `ragSource` file field extraction is implied\n * (a corpus source whose text is never extracted would be a silent no-op), so the only honest\n * remaining knobs are the ones that change HOW extraction runs.\n */\n textExtraction?: FileTextExtractionOptions;\n /**\n * Antivirus scan policy for this file field.\n * - 'required': always scan after upload, whatever the application-wide default says. If no scanner\n * is reachable the upload is FAILED rather than passed — a demanded scan that cannot run refuses.\n * - 'skip': never scan this field, even when the application has a scanner.\n * - undefined: inherit the application-wide default, which is DERIVED from whether a scanner is\n * reachable at all (a ClamAV host, or YARA both enabled and reachable). Provisioning the sidecar IS\n * the application-level opt-in; there is no separate on/off flag to set.\n *\n * That last line named `appConfig.files.scanning.enabled` until 2026-09-09. No configuration schema\n * has ever declared a `files` section, so the value an undeclared field inherited was `false` in every\n * application — this text described a switch that could not be turned on.\n */\n scanPolicy?: 'required' | 'skip';\n /** Behavior when parent resource is deleted (default: CASCADE) */\n onParentDelete?: FileOnParentDelete;\n /**\n * Whether this file field supports public sharing via consumable tokens.\n * When true, the `POST /files/:fileId/share` endpoint will generate a\n * `FILE_PUBLIC_ACCESS` consumable token for this file.\n * @default false\n */\n sharable?: boolean;\n /**\n * Default sharing configuration when `sharable` is true.\n * Controls token duration and max uses for shared links.\n */\n sharableDefaults?: {\n /** Default expiration for share tokens */\n expiresIn?: ExpiresInDuration;\n /** Default max uses for share tokens (BOUNDED_REUSE) */\n maxUses?: number;\n /** Default consumption mode. Defaults to BOUNDED_REUSE if not specified. */\n consumptionMode?: 'SINGLE_USE' | 'BOUNDED_REUSE';\n };\n}\n/** @wildo_source:part:end zod.decorators.file-schema */\n\n/**\n * @wildo_source:part:start zod.decorators.file-rag-source facet:layer:shared facet:family:decorator facet:family:file facet:kind:api facet:audience:app-developer\n *\n * File-side text-extraction knobs (see {@link FileSchemaMetadata.textExtraction} for why these are\n * NOT part of {@link RagSourceConfiguration}).\n *\n * Import from `@wildo-ai/zod-decorators` and pass under `z_file({ textExtraction })`. Extraction\n * answers \"how are this file's BYTES turned into text\"; chunking (`RagSourceConfiguration`) answers\n * \"how is that text split\", and is identical for a file field and a plain string field.\n */\nexport interface FileTextExtractionOptions {\n /**\n * Opt into OCR for image-backed content (scanned documents, photos of text). Off by default:\n * OCR is an external, per-page cost, and most corpus files (PDF with a text layer, plain text,\n * markdown) never need it.\n * @default false\n */\n ocr?: boolean;\n}\n/** @wildo_source:part:end zod.decorators.file-rag-source */\n\n/**\n * Options for creating a file schema.\n */\nexport interface FileSchemaOptions {\n /** Whether existing files can be replaced/overridden (default: true) */\n overridable?: boolean;\n /** Allowed MIME types - can be array of MIME types or group names */\n allowedMimeTypes?: string[] | FileMimeTypeGroup | FileMimeTypeGroup[];\n /** Maximum file size in bytes */\n maxSize?: number;\n /** Minimum file size in bytes */\n minSize?: number;\n /** Whether multiple files can be uploaded (default: false) */\n multiple?: boolean;\n /** Maximum number of files (when multiple is true) */\n maxFiles?: number;\n /** File nature classification */\n nature?: FileNature;\n /** Storage providers accepted for file uploads */\n storageAccepted?: FileStorageAccepted[];\n /** File path binding for structured storage organization */\n filePathBinding?: FilePathBinding;\n /**\n * Marks this file as generated by a framework operation.\n *\n * `FileGenerationSource.PDF_TEMPLATE` is v1's only source and is always\n * single-file PDF output; callers must not combine it with upload-style MIME\n * broadening or multiple-file semantics.\n */\n generation?: FileGenerationConfig;\n /** Image-specific constraints */\n imageConstraints?: FileNatureConstraints_Image;\n /** Video-specific constraints */\n videoConstraints?: FileNatureConstraints_Video;\n /** Audio-specific constraints */\n audioConstraints?: FileNatureConstraints_Audio;\n /** Document-specific constraints */\n documentConstraints?: FileNatureConstraints_Document;\n /**\n * @wildo_source:part:start zod.decorators.file-rag-source facet:layer:shared facet:family:decorator facet:family:file facet:kind:api facet:audience:app-developer\n *\n * Declare this file field a RAG retrieval-corpus source.\n *\n * (The two `z_file()` options below are declared on `FileSchemaOptions` — the object literal\n * `z_file()` accepts.)\n *\n * `z_file({ ragSource: {} })` registers the shared {@link ZodDecorator.RAG_SOURCE} decorator on\n * the schema it returns — the SAME decorator `z.string().ragSource()` uses — so detection and\n * every downstream seam (chunk store, erasure, re-index) see one uniform declaration. The config\n * is stored ONLY on the decorator (read it with `getRagSourceConfig`), never duplicated into\n * {@link FileSchemaMetadata}; how the file's TEXT is obtained is the sibling\n * {@link FileSchemaOptions.textExtraction} knob.\n *\n * Refused with `generation` (a PDF-template output is framework-rendered presentation, not an\n * authored corpus), and subject to the decorator chokepoint's own refusals (secrets, `.ttl()`).\n */\n ragSource?: RagSourceConfiguration;\n /**\n * Text-provider configuration for this file field (OCR opt-in). See\n * {@link FileSchemaMetadata.textExtraction} for the extraction-vs-chunking split.\n */\n textExtraction?: FileTextExtractionOptions;\n /** @wildo_source:part:end zod.decorators.file-rag-source */\n /**\n * Antivirus scan policy for this file field.\n * - 'required': always scan after upload, whatever the application-wide default says. If no scanner\n * is reachable the upload is FAILED rather than passed — a demanded scan that cannot run refuses.\n * - 'skip': never scan this field, even when the application has a scanner.\n * - undefined: inherit the application-wide default, which is DERIVED from whether a scanner is\n * reachable at all (a ClamAV host, or YARA both enabled and reachable). Provisioning the sidecar IS\n * the application-level opt-in; there is no separate on/off flag to set.\n *\n * That last line named `appConfig.files.scanning.enabled` until 2026-09-09. No configuration schema\n * has ever declared a `files` section, so the value an undeclared field inherited was `false` in every\n * application — this text described a switch that could not be turned on.\n */\n scanPolicy?: 'required' | 'skip';\n /** Behavior when parent resource is deleted (default: CASCADE) */\n onParentDelete?: FileOnParentDelete;\n /**\n * Whether this file field supports public sharing via consumable tokens.\n * When true, the `POST /files/:fileId/share` endpoint will generate a\n * `FILE_PUBLIC_ACCESS` consumable token for this file.\n * @default false\n */\n sharable?: boolean;\n /**\n * Default sharing configuration when `sharable` is true.\n * Controls token duration and max uses for shared links.\n */\n sharableDefaults?: {\n /** Default expiration for share tokens */\n expiresIn?: ExpiresInDuration;\n /** Default max uses for share tokens (BOUNDED_REUSE) */\n maxUses?: number;\n /** Default consumption mode. Defaults to BOUNDED_REUSE if not specified. */\n consumptionMode?: 'SINGLE_USE' | 'BOUNDED_REUSE';\n };\n}\n\n/**\n * File field endpoint URLs for file operations.\n * These are passed to the form field component.\n */\nexport interface FileFieldEndpoints {\n /** URL to get file metadata */\n getMetadata: string;\n /** URL to upload a new file. Omitted when the field is intentionally read-only or fail-closed. */\n upload?: string;\n /** URL to override/replace an existing file (optional, uses upload if not provided) */\n override?: string;\n /** URL to delete a file (optional) */\n delete?: string;\n /**\n * Base URL of the resource-integrated file **serve** route for this field, with\n * parent/resource ids already substituted:\n * `{apiBase}/api/v1/…/{resourceId}/files/{fieldSegment}`. The display consumer\n * appends `/{fileId}` and fetches the bytes over the AUTHENTICATED client\n * (authorization inherits the parent resource's READ). Omitted when no resource\n * context is available (fail-closed to the neutral file card). This is distinct\n * from the global `/files/:fileId` download/share surface.\n */\n serve?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// VERSIONED SCHEMA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * Metadata stored on versioned schemas for detection and configuration.\n * Versioned schemas automatically track version history.\n */\nexport interface VersionedSchemaMetadata {\n /** Marker for detecting versioned schemas */\n isVersioned: true;\n /** Initial version number for new records (default: 1) */\n initialVersion?: number;\n}\n\n/**\n * Metadata stored on versioned foreign key schemas for detection and configuration.\n * Versioned foreign keys reference versioned resources.\n */\nexport interface VersionedForeignKeySchemaMetadata {\n /** Marker for detecting versioned foreign key schemas */\n isVersionedForeignKey: true;\n /** The name of the target resource this foreign key references */\n targetResource?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// OTHERS METADATA TYPES\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.structural-lifecycle-params facet:layer:shared facet:layer:backend facet:family:decorator facet:family:lifecycle\n *\n * Structural and lifecycle decorator parameter types for shared resource\n * schemas.\n *\n * These shapes belong to the shared schema layer:\n * `shared-lib/src/modules/<module>/resources/<resource>/<resource>.schemas.ts`.\n *\n * They describe field behavior that affects persistence, DTO derivation,\n * security boundaries, discriminated variants, validation lifecycle, and other\n * cross-layer mechanics. They are appropriate in the shared Zod schema because\n * backend and frontend consumers both depend on the resulting metadata.\n *\n * Do NOT place per-field UI rendering configuration here. UI decorators such as\n * `.stringUI()` / `.enumUI()` belong in frontend `*.ui-behavior.tsx` files.\n * Do NOT place business-semantics prose here. `{primitive}Spec()` decorators\n * belong in specification overlays.\n *\n * When framework knowledge is generated, this anchored block is intended to be\n * inserted as the deterministic source-of-truth reference for structural\n * decorator parameters instead of maintaining parallel markdown tables.\n */\n// Parameters for the IS_HIDDEN decorator. Controls field visibility based on context.\nexport interface HiddenFieldParams {\n display?: boolean; // Hide in display/read mode\n edit?: boolean; // Hide in edit/form mode\n operations?: string[]; // Hide for specific operations (e.g., 'create', 'update')\n}\n\n// Parameters for the IS_NOT_EDITABLE decorator. Controls when a field is read-only in forms.\nexport interface NotEditableFieldParams {\n operations?: string[]; // Make not editable only for specific operations (e.g., 'update'). If not provided, applies to all operations.\n}\n\n// HiddenFieldParams, NotEditableFieldParams\n// are imported from @wildo-ai/presets-components-models\n\n/**\n * Inline edit mode options\n */\nexport const InlineEditMode = {\n DIRECT: 'direct',\n BUTTON: 'button',\n} as const;\nexport type InlineEditMode = typeof InlineEditMode[keyof typeof InlineEditMode];\n\n/**\n * P10: When to trigger save in inline editing mode\n */\nexport const InlineEditSaveOn = {\n /** Save on blur (when user clicks away) */\n BLUR: 'blur',\n /** Save only on explicit button click */\n EXPLICIT: 'explicit',\n} as const;\nexport type InlineEditSaveOn = typeof InlineEditSaveOn[keyof typeof InlineEditSaveOn];\n\n//------------------------------------------------------------------------------------------------\n// BACKEND-ONLY FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Parameters for the isBackendOnly decorator.\n * Marks fields that should only exist on the backend and be stripped from API responses.\n */\nexport interface BackendOnlyFieldParams {\n /**\n * If true, the field will be included in the response for CREATE operations only,\n * then stripped from all subsequent READ operations.\n * Useful for secrets, API keys, etc. that should only be returned once.\n *\n * This is one of the framework's two disclosure-audit triggers: a field that carries it emits one\n * `FIELD_ACCESS` audit event at the moment it is first (and last) exposed. That pairing is not a\n * coincidence: first exposure is the only point at which a backend-only field crosses the client\n * boundary at all, so it is the only point at which \"this value left the system\" is a true claim.\n *\n * The other trigger is `.isEphemeral()`, which fires on ANY operation rather than only on create,\n * so a rotate or a regenerate that hands the secret over again is recorded too. The two answer\n * different questions and neither implies the other: this one names the stored artifact, the\n * ephemeral marker names the value actually handed over. A field may carry either, both, or\n * neither, and one marked both is audited once.\n *\n * Scope limit worth knowing before relying on either: the audit event is raised from the TOP-LEVEL\n * shape of the response DTO. A single `CREATE` is the reliably covered case; do not assume a\n * bulk-create response gives you the same guarantee without checking.\n *\n * assurance-control: WILDO.SECRETS.DISCLOSURE_AUDIT — first disclosure of server-minted secret\n * material is attributable.\n */\n isReturnedAtCreation?: boolean;\n}\n\n/**\n * Parameters for the isWriteOnlySecret decorator.\n * Marks a user-provided secret that stays in CREATE/UPDATE request DTOs\n * (client-writable) but is masked to a placeholder on every client-facing\n * response DTO; the real value is retained for backend internal reads.\n * Read-side masking and the write-back sentinel are enforced by the framework\n * at the client-serialization boundary — no per-resource custom implementation\n * needed.\n *\n * Pick the right secret posture by **who owns the value and which direction it\n * flows** — the three are mutually exclusive on a field:\n * - `.isWriteOnlySecret()` — the CLIENT supplies the secret and the server keeps\n * it (e.g. a webhook signing key, an SSO client secret). Client-writable,\n * masked on read, real value kept for backend use. Re-submitting the mask is\n * a no-op (the stored value is preserved).\n * - `.isEphemeral()` — the SERVER mints the secret and hands it to the client\n * exactly once at creation (e.g. an API key shown in a one-time reveal). Not\n * client-writable, not re-readable afterwards. A composite decorator (secret\n * display + one-time reveal + not-editable).\n * - `.isBackendOnly()` — the field never crosses the client boundary in EITHER\n * direction. Do NOT use it for a client-provided secret: it strips the field\n * from the write DTOs too, so the client could never set the value.\n */\nexport interface WriteOnlySecretFieldParams {\n /**\n * Intentionally empty.\n *\n * A write-only secret is masked on EVERY client-facing response, so there is no disclosure to\n * audit — the real value never crosses the boundary. The parameter bag is kept so the decorator\n * can gain options later without changing its call shape.\n */\n readonly _reserved?: never;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// IMPERSONALIZATION SCRUB PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * Stored metadata for the impersonalization scrub treatment (`.impersonalizeWith()` /\n * `addImpersonalizeWith()`).\n *\n * This metadata deliberately stays outside the `shared-structural-params` subsection, mirroring\n * the decorator method itself. Impersonalization has distinct lifecycle and retention semantics,\n * so it needs dedicated application-facing guidance when the installed runtime exposes it.\n */\nexport interface ImpersonalizeFieldParams {\n /**\n * The scrub treatment — a `RedactionType` value carried as an opaque string (zod-decorators sits\n * below saas-models and cannot reference the enum type). REQUIRED and non-empty: a field either\n * declares how it is scrubbed, or carries no treatment at all.\n */\n treatment: string;\n /**\n * `MASK` only — the literal value written in place of this field, overriding the framework's\n * default mask constant.\n *\n * **Why this exists.** The default mask is an UNCONSTRAINED string, so it cannot be written into\n * exactly the fields most likely to need masking: a CONSTRAINED string — `z.email()`, `z.uuid()`,\n * `.min(n)` — rejects it and the boot guard fails the config. Without an override, such a field\n * can only be erased by widening it to `.nullish()` for a `REMOVE` scrub. For a unique identity\n * anchor (`User.email` is the motivating case) that trades a permanently weaker type on every\n * consumer for a state only the audited see-through reader can ever observe, since a retained row\n * is hidden from every normal read. The override keeps the authored type intact.\n *\n * **Contract.** The value must satisfy the field's OWN schema — the boot guard `safeParse`s it\n * against that schema and fails loud otherwise. It is STATIC: the same value is written to every\n * row of a scrub batch (the scrub is one `$set`), so choose something meaningless as data and\n * safe to collide on. For an email, an RFC 2606 reserved `.invalid` address is the honest choice —\n * that TLD can never be registered or delivered to.\n *\n * **Collision is not a concern**, even on a `.isUnique()` field: every unique index on a\n * retention-governed resource is scoped to NON-RETAINED rows, and the scrub flips the row to\n * `RETAINED` in the same write, so scrubbed rows leave the index.\n *\n * Declaring it alongside a non-`MASK` treatment is a config error — nothing would ever write it.\n * That check lives in the saas-models boot guard, which is the layer that knows `RedactionType`.\n */\n maskValue?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// VIRTUAL FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * Parameters passed to virtual field calculation functions.\n * The `utils` is typed as `any` in shared-lib but will be properly typed at runtime in backend-lib.\n */\nexport interface VirtualFieldCalculationParams<TObject = any, TContext = any, TUserContext = any> {\n /** The current resource object */\n currentObject: TObject;\n /** The resource context (parent/child relationships) - only if needsObjectContext is true */\n objectContext?: TContext;\n /** The user context - only if needsUserContext is true */\n userContext?: TUserContext;\n /** The execution context containing user, organization, etc. */\n executionContext: any;\n /**\n * Utility services for calculations.\n * Typed as `any` in shared-lib, but at runtime provides:\n * - repositories: RepositoryRegistry\n * - logger: LoggerService\n * - errorBuilder: ErrorBuilderBackendService\n * - dateService: DateService\n * - getService: <T>(symbol: symbol) => T\n */\n utils: any;\n}\n\n/**\n * Parameters for the isVirtual decorator.\n * Virtual fields are computed at runtime and not stored in the database.\n */\nexport interface VirtualFieldParams<TObject = any, TResult = any> {\n /**\n * The calculation function that computes this virtual field's value.\n * Called at runtime by VirtualFieldsBackendService with injected utilities.\n */\n calculate: (params: VirtualFieldCalculationParams<TObject>) => TResult | Promise<TResult>;\n\n /**\n * If true, the objectContext (parent/child relationships) will be passed to calculate().\n * Setting this to true has a performance cost as it requires fetching related resources.\n */\n needsObjectContext?: boolean;\n\n /**\n * If true, the userContext will be passed to calculate().\n * Setting this to true requires additional context resolution.\n */\n needsUserContext?: boolean;\n\n /**\n * Optional list of field names this virtual field depends on.\n * Used for documentation and potential future optimizations.\n */\n dependencies?: string[];\n}\n\n//------------------------------------------------------------------------------------------------\n// DISCRIMINATOR FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Parameters for the isDiscriminator decorator.\n * Marks a field as the discriminator for a discriminated union schema.\n */\nexport interface DiscriminatorFieldParams {\n /**\n * Values for which the base schema is used (no extended variant).\n * If not provided, auto-detected from enum values not covered by variants.\n */\n baseValues?: string[];\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// UNIQUE FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Scope for unique constraint enforcement.\n * - 'global': Unique across the entire collection (default)\n * - 'organization': Unique within an organization (compound index with organizationId)\n * - 'user': Unique per user (compound index with createdByUserId)\n */\nexport const UniqueScope = {\n GLOBAL: 'global',\n ORGANIZATION: 'organization',\n USER: 'user',\n} as const;\nexport type UniqueScope = typeof UniqueScope[keyof typeof UniqueScope];\n\n/**\n * Parameters for the isUnique decorator.\n * Marks a field as unique in the database with unique index.\n * MongoDB will enforce uniqueness and throw E11000 duplicate key error on violations.\n */\nexport interface UniqueFieldParams {\n /**\n * Scope for uniqueness constraint.\n * - 'global': Unique across the entire collection (default)\n * - 'organization': Unique per organization (compound index with organizationId)\n * - 'user': Unique per user (compound index with createdByUserId)\n */\n scope?: UniqueScope;\n\n /**\n * Create a compound unique index with another field in the same schema.\n * The referenced field name is resolved against the actual schema fields,\n * handling polymorphic field renames automatically.\n *\n * @example poolKey: z.string().isUnique({ compoundWith: 'billingAccountId' })\n * // Creates compound unique index: { billingAccountId: 1, poolKey: 1 }\n * // For polymorphic variants, resolves e.g. to: { organizationBillingAccountId: 1, poolKey: 1 }\n */\n compoundWith?: string;\n\n /**\n * Whether to allow null values without triggering uniqueness.\n * MongoDB unique indexes exclude null by default when sparse is true.\n * @default true\n */\n sparse?: boolean;\n\n /**\n * Custom error message to show when uniqueness is violated.\n * Supports placeholder {fieldName} which is replaced with the actual field name.\n * @example \"This {fieldName} is already taken\"\n */\n errorMessage?: string;\n\n /**\n * The custom message reference the API returns when THIS field's unique index is violated.\n *\n * Without it, every duplicate-key rejection collapses to one generic conflict code, so an\n * integrator cannot tell \"that slug is taken\" from \"that invoice number is taken\" without\n * parsing a message. Naming the reference here — next to the constraint that produces it —\n * keeps one authority: the key and the error it raises cannot drift apart.\n *\n * Pass a member of the framework's error-reference vocabulary, never a bare literal.\n *\n * @example slug: z.string().isUnique({ conflictMessageReference: ErrorCustomMessageReference.ORGANIZATION_SLUG_EXISTS })\n */\n conflictMessageReference?: string;\n}\n\n/**\n * Parameters for the object-level `businessKeySet([...])` decorator.\n *\n * Declares a **composite business key**: the ordered list of `fields` is the stable identity of a\n * row, used both by seeding upsert / upgrade / sync passes to find an existing row independently\n * from its random `_id`, and by the storage adapter to materialize a compound UNIQUE index so the\n * identity is enforced by the database rather than by a race-prone read-then-write.\n *\n * - `fields` must be non-empty and every entry must be a key declared on the\n * underlying `ZodObject` shape (validated at decoration time).\n * - This decorator is **mutually exclusive** with field-level `isBusinessKey()`\n * on the same schema — pick one identity model.\n *\n * @example\n * // \"one membership per user per organization\"\n * z.object({ userId: z.string(), organizationId: z.string(), roles: z.array(z.string()) })\n * .businessKeySet(['userId', 'organizationId'])\n */\nexport interface BusinessKeySetParams {\n fields: string[];\n\n /**\n * Fields whose ABSENCE takes a row out of the uniqueness constraint entirely.\n *\n * By default a missing member counts as a real value, so two rows that both omit it COLLIDE.\n * That is the correct default for an identity whose members are always meaningful — two rows\n * that are \"unscoped\" in the same way really are the same row.\n *\n * It is wrong when a member is optional in the domain sense: \"unit code, unique among siblings\"\n * must still allow any number of siblings that carry NO code. Listing that field here scopes the\n * constraint to the rows that actually have it.\n *\n * Every entry must also appear in `fields`. List only the members whose absence means \"this row\n * has no key\", never merely \"this member happens to be optional\" — a field left out of the list\n * keeps the default null-collides behaviour, which is what most composite keys want.\n *\n * @example\n * // many code-less siblings are fine; two siblings sharing a code are not\n * .businessKeySet(['organizationId', 'parentUnitId', 'code'], { skipRowsMissing: ['code'] })\n */\n skipRowsMissing?: string[];\n\n /**\n * The custom message reference the API returns when THIS key's unique index is violated.\n *\n * Without it, every duplicate-key rejection collapses to one generic conflict code, so an\n * integrator cannot tell which identity was violated without parsing a message. Naming the\n * reference here — next to the key that produces it — keeps one authority: the key and the error\n * it raises cannot drift apart.\n *\n * Pass a member of the framework's error-reference vocabulary, never a bare literal.\n */\n conflictMessageReference?: string;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// TTL FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Parameters for the ttl decorator.\n *\n * Declares a ROW LIFETIME: rows of this resource are deleted once the instant derived from this\n * Date field has passed. This is storage limitation — a compliance surface — not housekeeping, so\n * the declaration is ADAPTER-NEUTRAL and means the same thing wherever the resource is stored.\n *\n * How the deletion happens differs, and you do not choose it:\n * - on MongoDB, a native index expires the rows;\n * - on PostgreSQL there is no equivalent, so a scheduled sweep deletes them in bounded batches.\n *\n * The sweep is registered whichever store is in use, so a resource that declares a lifetime is\n * enforced on both. Do NOT read the MongoDB index as the mechanism and conclude the declaration is\n * inert elsewhere.\n *\n * Two consequences worth knowing before you declare one:\n * - the sweep is deliberately bounded per run, so a table receiving rows faster than they expire\n * stays above its target until the rate changes; it reports when it stops early;\n * - a resource CANNOT declare both a lifetime and retrieval-source fields (`.ragSource()`). That\n * pair is refused at startup, because rows expiring under a native index leave with no\n * application code running, so the derived search chunks could never be removed with them.\n *\n * This is unrelated to `retentionPolicy`, which decides what an ERASURE does to a row that must\n * SURVIVE. This one decides whether the row lives at all.\n *\n * @example\n * createdAt: z.date().ttl({ expireAfterSeconds: 3600 }) // Expire 1 hour after createdAt\n *\n * @example\n * expiresAt: z.date().ttl({ expireAfterSeconds: 0 }) // Expire at the exact date value\n */\nexport interface TtlFieldParams {\n /**\n * Number of seconds after the field's date value when the document should be deleted.\n * - 0: Document expires at the exact date/time stored in the field\n * - N > 0: Document expires N seconds after the date/time stored in the field\n *\n * @example\n * // Expire documents 24 hours after createdAt\n * createdAt: z.date().ttl({ expireAfterSeconds: 86400 })\n *\n * @example\n * // Expire documents at the exact expiresAt date\n * expiresAt: z.date().ttl({ expireAfterSeconds: 0 })\n */\n expireAfterSeconds: number;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// OTP FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * Parameters for the isOtp decorator.\n * Configures the OTP (One-Time Password) input field behavior.\n */\nexport interface OtpFieldParams {\n /**\n * Maximum length of the OTP code.\n * Determines how many input slots are rendered.\n *\n * @default 6\n *\n * @example\n * // 6-digit OTP code\n * otpCode: z.string().isOtp()\n *\n * @example\n * // 4-digit PIN\n * pin: z.string().isOtp({ maxLength: 4 })\n */\n maxLength?: number;\n}\n\n//------------------------------------------------------------------------------------------------\n// SUMMARY FIELD PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface\n *\n * Parameters for the isSummaryField decorator.\n * Controls how summary fields are handled, particularly for foreign key population.\n */\nexport interface SummaryFieldParams {\n /**\n * Whether to populate this foreign key field with the related resource's summary data.\n * Only applicable when the field also has isForeignKey() decorator.\n *\n * When true:\n * - The related resource will be fetched using the resourceIdentifier naming convention\n * - Only the related resource's isSummaryField fields will be included\n * - The populated data is optional (null if the related resource doesn't exist)\n *\n * @default false\n *\n * @example\n * // Field definition:\n * userId: z.string().isForeignKey().isSummaryField({ populate: true })\n *\n * // LIST/SEARCH response will include:\n * {\n * _id: \"123\",\n * userId: \"user-456\",\n * user: { _id: \"user-456\", email: \"...\", displayName: \"...\" } // populated summary\n * }\n */\n populate?: boolean;\n}\n/** @wildo_source:part:end zod.decorators.shared-structural-params */\n\n//------------------------------------------------------------------------------------------------\n// FORM VALIDATION DECORATOR PARAMS\n//------------------------------------------------------------------------------------------------\n\n/**\n * Validation mode for form fields.\n * Configures when field validation is triggered.\n * - ON_CHANGE: Validate on every change (with debounce for text fields)\n * - ON_BLUR: Validate when field loses focus (default for text fields)\n * - ON_TOUCHED: Validate on blur initially, then on every change once touched\n * - ON_SUBMIT: Validate only on form submission\n */\nexport enum ValidationMode {\n ON_CHANGE = 'onChange',\n ON_BLUR = 'onBlur',\n ON_TOUCHED = 'onTouched',\n ON_SUBMIT = 'onSubmit',\n}\n\n/**\n * Trigger mechanism for autosave.\n * - DEBOUNCE: Save after a delay following the last change\n * - BLUR: Save when field loses focus\n * - NONE: Disable autosave for this field\n */\nexport enum AutosaveTrigger {\n DEBOUNCE = 'debounce',\n BLUR = 'blur',\n NONE = 'none',\n}\n\nexport interface AutosaveFieldParams {\n /**\n * Whether autosave is enabled for this field.\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Trigger mechanism for autosave.\n * - AutosaveTrigger.DEBOUNCE: Save after a delay following the last change\n * - AutosaveTrigger.BLUR: Save when field loses focus\n * - AutosaveTrigger.NONE: Disable autosave for this field\n * @default AutosaveTrigger.DEBOUNCE\n */\n trigger?: AutosaveTrigger;\n\n /**\n * Debounce delay in milliseconds (only for DEBOUNCE trigger).\n * @default 500\n */\n debounceMs?: number;\n}\n/** @wildo_source:part:end zod.decorators.structural-lifecycle-params */\n\n// ==========================================================================================================================================================\n// SHOW WHEN TYPES (FIX-P5-H1)\n// ==========================================================================================================================================================\n\n/**\n * @wildo_source:part:start zod.decorators.conditional-visibility facet:layer:frontend facet:family:form facet:surface:conditional\n *\n * FIX-P5-H1: Operator for showWhen condition comparison.\n * - EQUALS: Field value equals the specified value\n * - NOT_EQUALS: Field value does not equal the specified value\n * - IN: Field value is in the specified array\n * - NOT_IN: Field value is not in the specified array\n * - EXISTS: Field value exists (is defined and not null)\n * - NOT_EXISTS: Field value does not exist (undefined or null)\n */\nexport enum ShowWhenOperator {\n EQUALS = 'equals',\n NOT_EQUALS = 'notEquals',\n IN = 'in',\n NOT_IN = 'notIn',\n EXISTS = 'exists',\n NOT_EXISTS = 'notExists',\n}\n\n/**\n * FIX-P5-H1: A single condition for showWhen decorator.\n * The field is visible when this condition is satisfied.\n */\nexport interface ShowWhenCondition {\n /** Field name to watch for changes */\n field: string;\n\n /**\n * Value(s) that satisfy the condition.\n * For EQUALS/NOT_EQUALS: single value or array\n * For IN/NOT_IN: array of values\n * For EXISTS/NOT_EXISTS: ignored\n */\n value?: unknown | unknown[];\n\n /**\n * Comparison operator.\n * @default ShowWhenOperator.EQUALS\n */\n operator?: ShowWhenOperator;\n}\n\n/**\n * FIX-P5-H1: Parameters for the showWhen decorator.\n * Configures conditional visibility for form fields.\n *\n * Available on every form-field type — each primitive, plus object and array, plus the `optional` /\n * `default` / `nullable` wrappers — matching `ZodDecorator_ApplyableType[SHOW_WHEN]`. The bare form\n * below is the documented one and works as written; before 2026-08-12 it threw, because the\n * decorator was installed on the wrapper prototypes only.\n *\n * @example\n * ```ts\n * // Show when 'type' field equals 'advanced'\n * advancedOption: z.string().showWhen({\n * conditions: { field: 'type', value: 'advanced' }\n * })\n *\n * // Show when 'type' is one of multiple values\n * featureOption: z.string().showWhen({\n * conditions: { field: 'type', value: ['pro', 'enterprise'], operator: ShowWhenOperator.IN }\n * })\n *\n * // On a defaulted field — the shape used by Wonder Todos' `reminder.leadTimeMinutes`\n * leadTimeMinutes: z.number().int().default(30).showWhen({\n * conditions: { field: 'enabled', value: true }\n * })\n *\n * // Show when both conditions are met\n * premiumFeature: z.string().showWhen({\n * conditions: [\n * { field: 'type', value: 'enterprise' },\n * { field: 'hasPremium', value: true }\n * ],\n * combineWith: 'and'\n * })\n * ```\n */\nexport interface ShowWhenParams {\n /**\n * Condition(s) that control visibility.\n * Can be a single condition or array of conditions.\n */\n conditions: ShowWhenCondition | ShowWhenCondition[];\n\n /**\n * How to combine multiple conditions.\n * - 'and': All conditions must be true (default)\n * - 'or': Any condition must be true\n * @default 'and'\n */\n combineWith?: 'and' | 'or';\n}\n/** @wildo_source:part:end zod.decorators.conditional-visibility */\n\n// ==========================================================================================================================================================\n// APP SCOPE FIELD TYPES\n// ==========================================================================================================================================================\n\n\n// ==========================================================================================================================================================\n// DRAFT CONFIG TYPES\n// ==========================================================================================================================================================\n\n/**\n * Parameters for the isDraftable decorator.\n * Configures draft mode behavior at the schema level.\n */\nexport interface DraftableConfigParams {\n /**\n * Field name that indicates draft status (discriminator).\n * @example 'status'\n */\n discriminator: string;\n\n /**\n * Value of the discriminator field that indicates draft mode.\n * @example 'DRAFT'\n */\n draftValue: string;\n\n /**\n * Value of the discriminator field that indicates published status.\n * If not provided, publishing will remove the discriminator field.\n * @example 'PUBLISHED'\n */\n publishedValue?: string;\n\n /**\n * Whether to require confirmation dialog before publishing.\n * @default false\n */\n requireConfirmationToPublish?: boolean;\n}\n\n\n// ==========================================================================================================================================================\n// PRIMITIVE UI DECORATOR TYPES — new unified {primitive}UI API (per ui-decorator-reorganization-analysis.md §3)\n// ==========================================================================================================================================================\n\n//------------------------------------------------------------------------------------------------\n// FORCE HIDE CONFIG — controls chrome sub-element visibility\n//------------------------------------------------------------------------------------------------\n\n/**\n * Force-hide specific chrome sub-elements in display context.\n * Display has no `error` sub-element to hide.\n */\nexport interface ForceHideDisplayConfig {\n label?: boolean;\n description?: boolean;\n}\n\n/**\n * Force-hide specific chrome sub-elements in edit context.\n * Extends display with `error` (form-specific).\n */\nexport interface ForceHideConfig extends ForceHideDisplayConfig {\n error?: boolean;\n}\n\n//------------------------------------------------------------------------------------------------\n// BOOLEAN LABELLING — custom label params for boolean fields\n//------------------------------------------------------------------------------------------------\n\n/**\n * Custom labelling for boolean true/false values when enum presets\n * (BooleanLabellingValue) are insufficient.\n */\nexport interface BooleanLabellingCustomParams {\n mode: 'custom';\n trueValue: string;\n falseValue: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// PRIMITIVE UI BASE PARAMS — shared across all {primitive}UI decorators\n//------------------------------------------------------------------------------------------------\n\n/**\n * How a display field's LABEL is styled, independent of chrome mode (which decides layout).\n *\n * - `DEFAULT` — the chrome's ordinary label treatment.\n * - `TITLE` — the label reads as a SMALL TITLE above its content (small, semibold, foreground):\n * for a field that acts as a mini-section inside a prose flow — \"Who suffers it\" above its\n * answer — where the ordinary muted label would not carry the structure.\n */\nexport const DisplayLabelStyle = {\n DEFAULT: 'default',\n TITLE: 'title',\n} as const;\nexport type DisplayLabelStyle = typeof DisplayLabelStyle[keyof typeof DisplayLabelStyle];\n\n/**\n * @wildo_source:part:start zod.decorators.primitive-ui\n *\n * Display-context base params.\n * Controls chrome, inline editing, and tooltip behavior when a field is rendered in a read-only view.\n */\nexport interface PrimitiveUIBaseDisplayParams {\n /** Override the display widget for this field (cross-cutting). Type-specific `displayMode` takes precedence. */\n component?: DisplayFieldComponent;\n\n /** Chrome layout mode for the field wrapper in display context. */\n chromeMode?: ResponsiveAware<DisplayChromeMode>;\n\n /** Label styling, orthogonal to `chromeMode` (which decides LAYOUT). See `DisplayLabelStyle`. */\n labelStyle?: DisplayLabelStyle;\n\n /** Force-hide specific chrome sub-elements in display context. Plain object = all breakpoints. */\n forceHide?: ResponsiveAware<ForceHideDisplayConfig>;\n\n /** Whether to show a tooltip icon in display chrome. Text comes from i18n. */\n tooltip?: boolean;\n\n /**\n * When `true`, the field is omitted entirely from the DISPLAY (read) surface\n * whenever its value is empty — null, undefined, an empty string, or an empty\n * array. The whole row (label + chrome + em-dash placeholder) is removed, not\n * just the value.\n *\n * DISPLAY-ONLY: the edit form always renders the field so an empty value can\n * still be filled in. This is the field-level counterpart to the section-level\n * `SectionConfigBase.hideWhenEmpty` and to the surface-policy\n * `AutoEmptyValue.HIDDEN` — use it to keep optional metadata (a job title, a\n * secondary contact) from cluttering a read view when unset.\n *\n * @example\n * // Hide the \"Title\" row on the profile read view until the user sets one:\n * schemaShape.title.stringUI({ display: { hideWhenEmpty: true } })\n */\n hideWhenEmpty?: boolean;\n\n /**\n * Opt-in for description text below the field value in display mode.\n * When true, the companion generates an i18n key for the description.\n * Absorbed from the deleted `.displayField({ showDescription })` decorator.\n */\n showDescription?: boolean;\n\n /**\n * Inline editing configuration. When set, the display value becomes editable in-place.\n */\n inlineEditable?: boolean | {\n mode?: InlineEditMode;\n saveOn?: InlineEditSaveOn;\n showSaveButton?: boolean;\n showCancelButton?: boolean;\n };\n}\n\n/**\n * Edit-context base params.\n * Controls chrome, validation, autosave, and focus behavior when a field is rendered in a form.\n */\nexport interface PrimitiveUIBaseEditParams {\n /** Override the form widget for this field (cross-cutting). Type-specific `editMode` takes precedence. */\n component?: FormFieldComponent;\n\n /** Chrome layout mode for the field wrapper in edit context. */\n chromeMode?: ResponsiveAware<EditChromeMode>;\n\n /** Force-hide specific chrome sub-elements in edit context. Plain object = all breakpoints. */\n forceHide?: ResponsiveAware<ForceHideConfig>;\n\n /** Whether to show a tooltip icon in form chrome. Text comes from i18n. */\n tooltip?: boolean;\n\n /** Auto-focus this field when the form mounts. */\n autoFocus?: boolean;\n\n /** Official HTML autocomplete field identifier for browser autofill. */\n autoComplete?: AutocompleteFieldIdentifier;\n\n /**\n * Optional official HTML autocomplete modifiers.\n * Supports a single modifier or an array. `section-*` is intentionally excluded\n * from this typed contract and can be added later via a dedicated API if needed.\n */\n autoCompleteModifier?: AutocompleteModifier | AutocompleteModifier[];\n\n /**\n * Opt-in for description/helper text below the form input in edit mode.\n * When true, the companion generates an i18n key for the description.\n * Absorbed from the deleted `.displayField({ showDescription })` decorator.\n */\n showDescription?: boolean;\n\n /** When to trigger validation. Falls back to resource-level defaultValidationMode. */\n validationMode?: ValidationMode;\n\n /** Autosave config for this field. Falls back to resource-level defaultAutosave. */\n autosave?: AutosaveFieldParams | true;\n}\n\n/**\n * Top-level base for all {primitive}UI decorators.\n * Splits configuration by UI context: display (detail views), summaryOverride (cards/lists), edit (forms).\n */\nexport interface PrimitiveUIBaseParams {\n /** Config for Display context (detail/read-only views). Primary display config. */\n display?: PrimitiveUIBaseDisplayParams;\n\n /** Config for DisplaySummary context (cards, list items, FK references). Overrides display defaults when rendering in summary. */\n summaryOverride?: PrimitiveUIBaseDisplayParams;\n\n /** Config for Edition context (forms). */\n edit?: PrimitiveUIBaseEditParams;\n}\n/** @wildo_source:part:end zod.decorators.primitive-ui */\n\n/**\n * @wildo_source:part:start zod.decorators.per-primitive-ui facet:layer:frontend facet:family:ui facet:surface:form facet:surface:display\n *\n * Per-primitive frontend UI decorator parameter types.\n *\n * These interfaces define the arguments accepted by decorators such as\n * `.stringUI()`, `.numberUI()`, `.enumUI()`, `.booleanUI()`, `.moneyUI()`,\n * `.foreignKeyUI()`, etc.\n *\n * They belong to the frontend resource behavior layer, not to shared resource\n * schemas. In application code, they are typically authored in files like:\n * `frontend/src/modules/<module>/resources/<resource>/<resource>.ui-behavior.tsx`\n *\n * The shared schema establishes structural meaning (`isSummaryField`,\n * `isForeignKey`, `excludeFromUpdate`, ...). These UI parameter types control\n * presentation concerns such as display widgets, edit widgets, chrome modes,\n * per-enum colors/icons, inline editing, and layout details.\n *\n * Generated framework knowledge should prefer extracting these definitions from\n * source rather than restating the supported UI parameters in handcrafted\n * markdown documents.\n */\n//------------------------------------------------------------------------------------------------\n// BOOLEAN UI\n//------------------------------------------------------------------------------------------------\n\nexport interface BooleanUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. RAW = plain text, CHECKMARK = checkmark/cross, EDIT_LIKE = shows the edit control read-only. */\n displayMode?: BooleanDisplayMode;\n}\n\nexport interface BooleanUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. TOGGLE = pill, SWITCH = iOS-style, CHECKBOX = classic, RADIO = two options. */\n editMode?: BooleanEditMode;\n}\n\nexport interface BooleanUIParams {\n /**\n * Labels for true/false values (cross-context — applies to display and edit).\n * Use BooleanLabellingValue enum presets or BooleanLabellingCustomParams for literal labels.\n */\n labellingValue?: BooleanLabellingValue | BooleanLabellingCustomParams;\n display?: BooleanUIDisplayParams;\n summaryOverride?: BooleanUIDisplayParams;\n edit?: BooleanUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// STRING UI\n//------------------------------------------------------------------------------------------------\n\nexport interface StringUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. TEXT | TRUNCATE | MULTILINE | MARKDOWN | COLOR | LINK | EMAIL | BADGE | COPY | SECRET. */\n displayMode?: StringDisplayMode;\n /** Max characters before truncation (TRUNCATE displayMode only). */\n truncateLength?: number;\n /**\n * SECRET displayMode only: render the value revealed (not masked) on first\n * paint. Defaults to `false` (masked, reveal via the eye toggle) for secrets\n * shown in persistent surfaces. `.isEphemeral()` sets this `true` because an\n * ephemeral one-time-reveal exists precisely so the caller can read + copy the\n * secret immediately; the toggle still lets them re-hide it.\n */\n initiallyRevealed?: boolean;\n}\n\nexport interface StringUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. INPUT | TEXTAREA | COLOR | PASSWORD | OTP. */\n editMode?: StringEditMode;\n /** Number of rows for TEXTAREA editMode. */\n textareaRows?: number;\n}\n\nexport interface StringUIParams {\n display?: StringUIDisplayParams;\n summaryOverride?: StringUIDisplayParams;\n edit?: StringUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// NUMBER UI\n//------------------------------------------------------------------------------------------------\n\nexport interface NumberUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. RAW | FORMATTED | PERCENTAGE | COMPACT | ORDINAL | BYTES. */\n displayMode?: NumberDisplayMode;\n}\n\nexport interface NumberUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. INPUT | SLIDER | STEPPER. */\n editMode?: NumberEditMode;\n}\n\nexport interface NumberUIParams {\n /** Number of decimal places (cross-context). */\n decimalPlaces?: number;\n /** Whether to show trailing zeros (e.g., 1.00 vs 1). */\n trailingZeros?: boolean;\n /** Prefix string displayed before the value (e.g., \"$\", \"€\"). */\n prefix?: string;\n /** Suffix string displayed after the value (e.g., \"kg\", \"%\", \"px\"). */\n suffix?: string;\n /** How to interpret percentage values: NORMALIZED (0–1) or PERCENT (0–100). */\n percentageScale?: PercentageScale;\n display?: NumberUIDisplayParams;\n summaryOverride?: NumberUIDisplayParams;\n edit?: NumberUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// ENUM UI\n//------------------------------------------------------------------------------------------------\n\nexport interface EnumUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. TEXT | BADGE | ICON | CARD. */\n displayMode?: EnumDisplayMode;\n}\n\nexport interface EnumUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. SELECT | RADIO | RADIO_ICON_ONLY | TOGGLE | TOGGLE_ICON_ONLY | CARD | CARD_ICON_ONLY | COMBOBOX. */\n editMode?: EnumEditMode;\n /** Direction of radio/toggle/checkbox group. Renamed from `layout`. */\n editDirection?: LayoutDirection;\n /** Number of grid columns for radio/toggle/card groups. Renamed from `columns`. */\n editColumnsCount?: number;\n}\n\nexport interface EnumUIParams {\n /** Per-value display config (cross-context — colors and icons used in both display badges and edit controls). */\n values?: Record<string, EnumValueDisplayConfig>;\n /** Default badge color when no per-value override (cross-context). */\n defaultColor?: BadgeSemanticVariant;\n /** Default icon when no per-value override (cross-context). */\n defaultIcon?: IconLike;\n display?: EnumUIDisplayParams;\n summaryOverride?: EnumUIDisplayParams;\n edit?: EnumUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// DATE / DATETIME / TIME UI\n//------------------------------------------------------------------------------------------------\n\nexport type DateUIDisplayParams = PrimitiveUIBaseDisplayParams;\nexport type DateUIEditParams = PrimitiveUIBaseEditParams;\nexport interface DateUIParams {\n display?: DateUIDisplayParams;\n summaryOverride?: DateUIDisplayParams;\n edit?: DateUIEditParams;\n}\n\nexport type DateTimeUIDisplayParams = PrimitiveUIBaseDisplayParams;\nexport type DateTimeUIEditParams = PrimitiveUIBaseEditParams;\nexport interface DateTimeUIParams {\n display?: DateTimeUIDisplayParams;\n summaryOverride?: DateTimeUIDisplayParams;\n edit?: DateTimeUIEditParams;\n}\n\nexport type TimeUIDisplayParams = PrimitiveUIBaseDisplayParams;\nexport type TimeUIEditParams = PrimitiveUIBaseEditParams;\nexport interface TimeUIParams {\n display?: TimeUIDisplayParams;\n summaryOverride?: TimeUIDisplayParams;\n edit?: TimeUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// MONEY UI\n//------------------------------------------------------------------------------------------------\n\nexport type MoneyUIDisplayParams = PrimitiveUIBaseDisplayParams;\n\nexport interface MoneyUIEditParams extends PrimitiveUIBaseEditParams {\n /** Initial/default currency shown in the picker. Moved from z_money(). ISO 4217. */\n defaultCurrency?: AvailableCurrency;\n}\n\nexport interface MoneyUIParams {\n display?: MoneyUIDisplayParams;\n summaryOverride?: MoneyUIDisplayParams;\n edit?: MoneyUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// CODE UI\n//------------------------------------------------------------------------------------------------\n\nexport interface CodeUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Show line numbers in display context. */\n showLineNumbers?: boolean;\n}\n\nexport interface CodeUIEditParams extends PrimitiveUIBaseEditParams {\n /** Show line numbers in editor. */\n showLineNumbers?: boolean;\n}\n\nexport interface CodeUIParams {\n /** Enable syntax highlighting (cross-context). */\n syntaxHighlighting?: boolean;\n /** Default language for the code editor/display (cross-context). Must be in allowedLanguages (from z_code()). */\n defaultLanguage?: CodeLanguage;\n display?: CodeUIDisplayParams;\n summaryOverride?: CodeUIDisplayParams;\n edit?: CodeUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// FILE UI\n//------------------------------------------------------------------------------------------------\n\nexport interface FileUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /**\n * How the file renders AT REST — see {@link FileDisplayPresentation}. Media display\n * is never mandatory: the default is the neutral file card, and `THUMBNAIL`/`FULL`\n * are opt-in. Rendered media is fetched over the authenticated resource-integrated\n * serve route (authz inherits the parent READ).\n * @default FileDisplayPresentation.CARD\n */\n presentation?: FileDisplayPresentation;\n /**\n * What activating the file does — see {@link FileActivationConfig}. Applies to every\n * nature. Omit for the nature-derived default: `OVERLAY` when a displayer exists for\n * the resolved nature, `DOWNLOAD` otherwise.\n */\n activation?: FileActivationConfig;\n /**\n * Presentation detail for rendered media (shape / size / caption). Applies when\n * `presentation` is `THUMBNAIL` or `FULL`; ignored by `CARD`.\n * @example { shape: FileMediaShape.CIRCLE, size: FileMediaSize.MD, showCaption: false } // avatar\n */\n preview?: FileMediaPreviewOptions;\n}\nexport type FileUIEditParams = PrimitiveUIBaseEditParams;\nexport interface FileUIParams {\n display?: FileUIDisplayParams;\n summaryOverride?: FileUIDisplayParams;\n edit?: FileUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// DURATION UI\n//------------------------------------------------------------------------------------------------\n\nexport type DurationUIDisplayParams = PrimitiveUIBaseDisplayParams;\n\nexport interface DurationUIEditParams extends PrimitiveUIBaseEditParams {\n /** Default unit shown in the picker. Must be in allowedUnits (from z_duration()). */\n defaultUnit?: DurationUnit;\n}\n\nexport interface DurationUIParams {\n display?: DurationUIDisplayParams;\n summaryOverride?: DurationUIDisplayParams;\n edit?: DurationUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// PHONE UI\n//------------------------------------------------------------------------------------------------\n\nexport type PhoneUIDisplayParams = PrimitiveUIBaseDisplayParams;\nexport type PhoneUIEditParams = PrimitiveUIBaseEditParams;\n\nexport interface PhoneUIParams {\n /**\n * Overrides factory defaultCountry for UI rendering (cross-context).\n * ISO 3166-1 alpha-2 code. Typed as string at this layer; consumers should use AvailableCountry\n * from presets-components-models for type safety.\n */\n displayCountry?: string;\n display?: PhoneUIDisplayParams;\n summaryOverride?: PhoneUIDisplayParams;\n edit?: PhoneUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// BIGDECIMAL UI\n//------------------------------------------------------------------------------------------------\n\nexport interface BigDecimalUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Display renderer. RAW | FORMATTED | PERCENTAGE. */\n displayMode?: BigDecimalDisplayMode;\n}\n\nexport interface BigDecimalUIEditParams extends PrimitiveUIBaseEditParams {\n /** Edit control. Only INPUT for arbitrary precision. */\n editMode?: BigDecimalEditMode;\n /** Default value shown in the editor before user interaction. Moved from bigDecimalConfig. */\n defaultValue?: string;\n}\n\nexport interface BigDecimalUIParams {\n /** Number of decimal places (cross-context). */\n decimalPlaces?: number;\n /** Whether to show trailing zeros (e.g., 1.00 vs 1). */\n trailingZeros?: boolean;\n /** Prefix string displayed before the value (e.g., \"$\", \"€\"). */\n prefix?: string;\n /** Suffix string displayed after the value (e.g., \"kg\", \"%\", \"px\"). */\n suffix?: string;\n /** How to interpret percentage values: NORMALIZED (0–1) or PERCENT (0–100). */\n percentageScale?: PercentageScale;\n display?: BigDecimalUIDisplayParams;\n summaryOverride?: BigDecimalUIDisplayParams;\n edit?: BigDecimalUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// FOREIGN KEY UI\n//------------------------------------------------------------------------------------------------\n\nexport interface ForeignKeyUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** How to render the FK reference. ID | LABEL | SUMMARY. */\n mode?: ForeignKeyDisplayMode;\n /** Whether the displayed FK value is a clickable link to the referenced resource. */\n linkable?: boolean;\n /** Override the preset used to display the referenced resource summary. */\n displayPresetOverride?: string;\n}\n\nexport interface ForeignKeyUIEditParams extends PrimitiveUIBaseEditParams {\n /**\n * How each RESULT in the reference picker's dropdown renders — applies to both\n * the form picker and the collection filter picker (they share one component):\n * - `LABEL` (default): a one-line resource label (via `getFrontendResourceLabel`).\n * - `SUMMARY`: the referenced resource's summary view — its summary fields with\n * NO action bar — rendered via `ResourceSummaryDisplayer`.\n * `ID` is treated as `LABEL` here (a raw id is not a useful picker row). Only the\n * dropdown options are affected; the selected value still shows as a label.\n */\n optionDisplayMode?: ForeignKeyDisplayMode;\n}\n\nexport interface ForeignKeyUIParams {\n display?: ForeignKeyUIDisplayParams;\n summaryOverride?: ForeignKeyUIDisplayParams;\n edit?: ForeignKeyUIEditParams;\n}\n\n//------------------------------------------------------------------------------------------------\n// ARRAY UI\n//------------------------------------------------------------------------------------------------\n\n/**\n * List marker treatment for a PRIMITIVE array's display items.\n *\n * Its own enum rather than a new `DisplayDirection` member on purpose: direction answers \"which\n * axis do items flow on\", marker style answers \"does each item announce itself as one of several\" —\n * merging them would make `BULLETS × horizontal` an unrepresentable-but-meaningful combination and\n * overload an enum that alignment code also reads.\n */\nexport enum ArrayListStyle {\n /** Bare stacked values — the historical default. */\n PLAIN = 'plain',\n /** A real bulleted list. For enumerations a reader SCANS — alternatives, consequences, principles — where bare stacked lines read as one run-on paragraph. */\n BULLETS = 'bullets',\n /**\n * A RULED list: one hairline between entries, none above the first or below the last.\n *\n * For OBJECT entries a reader compares — an ICP after an ICP, a persona after a persona — where\n * spacing alone stops saying where one ends. It is the alternative to framing each entry as a\n * card, and the reason to prefer it is compounding chrome: inside a section that is already a\n * bounded region, a card per entry is a third frame around content that has two. Unlike\n * {@link ArrayListStyle.BULLETS}, which is for primitive lines, this is for entries.\n */\n SEPARATED = 'separated',\n}\n\nexport interface ArrayUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Direction for rendering items in display context. */\n displayMode?: DisplayDirection;\n /** Max items shown in display (rest truncated). */\n maxItems?: number;\n /**\n * Marker treatment for PRIMITIVE items (see {@link ArrayListStyle}). No effect on object arrays —\n * their items are cards/rows, not list lines — and no effect on horizontal flow, where markers\n * have no line to anchor to.\n */\n listStyle?: ArrayListStyle;\n}\n\n/**\n * How NEW items are added to an array field in an edit / inline-edit surface.\n *\n * When unset, the renderer resolves a default by item shape: a SIMPLE item\n * (a primitive, or an object with a single prominent authored field — e.g. a\n * checklist `{ label, done }`) defaults to {@link ArrayAddMode.QUICK_ADD}; a\n * MULTI-field object defaults to {@link ArrayAddMode.APPEND_INLINE}.\n *\n * The key distinction is WHEN the new item is validated:\n * - `APPEND_INLINE` validates AFTER append (a freshly-added required field shows\n * its error until filled);\n * - `QUICK_ADD` / `DIALOG` validate BEFORE append (the list never holds a blank\n * or invalid item).\n */\nexport enum ArrayAddMode {\n /**\n * \"+ Add\" appends a blank, in-place editable item card/row; validated AFTER\n * it is added. Best for rich objects the author edits in place.\n */\n APPEND_INLINE = 'append-inline',\n /**\n * A single inline add-row (the item's primary field + Enter / \"+\"). The item\n * is built from the row and validated BEFORE it is appended, so the list never\n * holds a blank/invalid item. Best for simple items — checklists.\n */\n QUICK_ADD = 'quick-add',\n /**\n * \"+ Add\" opens a dialog with the item's form; the item is validated on submit\n * and then appended. Best for complex, multi-field items.\n */\n DIALOG = 'dialog',\n}\n\nexport interface ArrayUIEditParams extends PrimitiveUIBaseEditParams {\n /** Allow reordering via drag-and-drop in edit context. Set via `.isSortable()` convenience or directly. */\n isSortable?: boolean;\n /** Enable drag-and-drop reordering (default true when isSortable). */\n dnd?: boolean;\n /** Show up/down manual move buttons. */\n upDownIcons?: boolean;\n /**\n * How new items are added (append-inline / quick-add / dialog). When unset,\n * the renderer picks a default by item shape — see {@link ArrayAddMode}.\n */\n addMode?: ArrayAddMode;\n}\n\n/**\n * How each item of an OBJECT array (`z.array(z.object({...}))`) is framed in\n * BOTH display and edit surfaces.\n *\n * - `CARD` (default) — each item is a framed card (border + padding) with a\n * floating summary chip and a stacked column of its sub-fields. Best for\n * rich, multi-field items the author edits in place.\n * - `ROW` — each item is a compact single-row: its sub-fields render inline\n * (boolean fields lead as compact toggles — the \"☐\" of a checklist — then\n * the primary field fills the row), reorder/remove controls inline, NO card\n * frame or floating chip. Best for lists of small objects — checklists,\n * tag/value pairs, key-value rows.\n *\n * Applies to object-array items only; primitive arrays already render as rows.\n */\nexport enum ArrayObjectItemLayout {\n CARD = 'card',\n ROW = 'row',\n}\n\nexport interface ArrayUIParams {\n display?: ArrayUIDisplayParams;\n summaryOverride?: ArrayUIDisplayParams;\n edit?: ArrayUIEditParams;\n /**\n * How OBJECT-array items are framed (card vs compact row). Governs display\n * AND edit/inline-edit rendering. Defaults to {@link ArrayObjectItemLayout.CARD}.\n * No effect on primitive arrays. See {@link ArrayObjectItemLayout}.\n */\n objectItemLayout?: ArrayObjectItemLayout;\n}\n\n//------------------------------------------------------------------------------------------------\n// OBJECT UI\n//------------------------------------------------------------------------------------------------\n\nexport interface ObjectUIDisplayParams extends PrimitiveUIBaseDisplayParams {\n /** Direction for rendering properties in display context. */\n displayMode?: DisplayDirection;\n /** Max properties shown in display (rest truncated). */\n maxItems?: number;\n /**\n * The member that IS this object's headline when the object renders as a unit (a nested object\n * block, an array item card): it renders FIRST, label hidden, with title emphasis; the remaining\n * members follow in schema order.\n *\n * Explicit rather than detected: \"the first string field\" guesses wrong the moment a stable\n * identifier precedes the human statement in the schema — exactly the shape ref-addressable\n * entries have (`ref` first, `statement` second), where detection would headline the machine key.\n * Names a member that does not exist → ignored, so a schema rename degrades to the old uniform\n * rendering instead of crashing the display.\n */\n primaryField?: string;\n}\n\nexport type ObjectUIEditParams = PrimitiveUIBaseEditParams;\n\nexport interface ObjectUIParams {\n display?: ObjectUIDisplayParams;\n summaryOverride?: ObjectUIDisplayParams;\n edit?: ObjectUIEditParams;\n}\n/** @wildo_source:part:end zod.decorators.per-primitive-ui */\n\n//================================================================================================\n// FIELD SPEC — Per-primitive business semantics decorators (companion-only at runtime)\n//================================================================================================\n\n/**\n * @wildo_source:part:start zod.decorators.field-spec-params facet:layer:specification facet:family:companion facet:family:semantics\n *\n * Semantic specification parameter types for companion/specification overlays.\n *\n * These types are intentionally separate from both:\n * - shared schema structural decorators (`*.schemas.ts`)\n * - frontend UI decorators (`*.ui-behavior.tsx`)\n *\n * `{primitive}Spec()` calls belong in specification-side files such as\n * `specifications/src/modules/<module>/resources/<resource>.resource.specification.ts`.\n * They enrich schema fields with business meaning, importance, enum value\n * semantics, relationship context, and import-oriented symbol references used by\n * companion-time reasoning and code generation.\n *\n * These params should carry meaning that cannot be deterministically inferred\n * from the Zod type, requiredness, or structural decorators alone.\n */\n\n/**\n * Relative weight of a semantic entry inside its owning resource.\n *\n * Not about technical optionality — tells the AI how central a field is\n * to understanding the resource:\n * - PRIMARY: core to understanding or using the resource correctly.\n * The AI should prioritize these in summaries, forms, and behavior generation.\n * - CONTEXTUAL: provides useful context but is not central.\n * The AI can include or omit based on available space/attention.\n *\n * Default is CONTEXTUAL — only genuinely important fields should be explicitly\n * flagged as PRIMARY.\n */\nexport enum FieldSemanticImportance {\n PRIMARY = 'primary',\n CONTEXTUAL = 'contextual',\n}\n\n/**\n * Base field specification parameters shared by all `{primitive}Spec()` decorators.\n *\n * Carries the semantic delta that the Zod schema definition alone cannot convey:\n * domain meaning, business relevance, and guidance for the AI companion.\n *\n * These values are **never rendered in the frontend UI** — they exist on the\n * schema metadata for companion-time extraction only. The `{primitive}Spec()` calls\n * happen in the specification overlay (which the frontend never imports), so\n * the prose is attached to schema instances only in companion/test contexts.\n *\n * Do not duplicate information already expressed by the schema type, requiredness,\n * enum values, or structural decorators. This is for meaning that is not derivable.\n */\nexport enum CodeSymbolKind {\n SCHEMA = 'schema',\n ENUM = 'enum',\n FACTORY = 'factory',\n FUNCTION = 'function',\n CONFIG = 'config',\n TYPE = 'type',\n COMPONENT = 'component',\n UI_BEHAVIOR = 'uiBehavior',\n}\n\nexport enum CodeDeclarationKind {\n TYPESCRIPT_ENUM = 'typescriptEnum',\n CONST_OBJECT = 'constObject',\n ZOD_ENUM = 'zodEnum',\n LITERAL_UNION = 'literalUnion',\n ZOD_SCHEMA = 'zodSchema',\n FUNCTION = 'function',\n INTERFACE = 'interface',\n TYPE_ALIAS = 'typeAlias',\n UNKNOWN = 'unknown',\n}\n\n/**\n * Symbol reference used by semantic specifications to address one exported symbol.\n *\n * Downstream transposers and prompts prefer these refs over file-path guesses, so a\n * ref has to be honest about WHICH KIND of address it carries. Two facts are useful\n * and they are not the same fact, so they have separate fields:\n *\n * - `importPath` is an IMPORT SPECIFIER — something a generated `import` statement\n * can actually resolve, declared in the owning package's `package.json#exports`.\n * - `filePathHint` is a LOCATION — where a maintainer opens the file. It is never\n * rendered as something importable.\n *\n * Authoring a source path in `importPath` is the defect issue #150 records: it made\n * the companion hand a coding agent an import specifier that cannot resolve, because\n * an application package typically declares no export map entry for its internal\n * modules. When in doubt, author `filePathHint` — a location that is merely useful\n * is better than an address that is wrong.\n */\nexport interface CodeSymbolRef {\n /** Package name to import from (for example `@wildo-ai/saas-models`). */\n packageName: string;\n /**\n * Optional PUBLIC SUBPATH, when the package root is not the import target.\n *\n * Must be a subpath the owning package declares in `package.json#exports`, so that\n * `${packageName}/${importPath}` is a resolvable import specifier. If the symbol has\n * no public door, leave this unset and author `filePathHint` instead — do NOT put a\n * path inside `src/` here.\n */\n importPath?: string;\n /** Literal exported symbol name. */\n exportName: string;\n /** High-level category of symbol. */\n symbolKind: CodeSymbolKind;\n /** More specific declaration family for code-generation handling. */\n declarationKind?: CodeDeclarationKind;\n /**\n * Optional MODULE LOCATION — where the symbol is defined inside the owning package,\n * relative to that package's source root (for example\n * `modules/tasks-manager/resources/tasks/tasks.ui-behavior`).\n *\n * This is a navigation aid, not an import target: it is rendered as a location and\n * must never be concatenated onto `packageName` to build an import specifier.\n */\n filePathHint?: string;\n /** Extra caveats or usage notes for downstream prompts. */\n notes?: string[];\n}\n\n/**\n * Reference to one member of a declared enum/const-object vocabulary.\n */\nexport interface CodeEnumMemberRef {\n /** Declared enum/const-object that owns the member. */\n enumDeclaration: CodeSymbolRef;\n /** Literal member name on that declaration (for example `USERS`). */\n memberName: string;\n}\n\nexport enum CollectionElementKind {\n PRIMITIVE = 'primitive',\n ENUM = 'enum',\n FOREIGN_KEY = 'foreignKey',\n OBJECT = 'object',\n SCHEMA_REF = 'schemaRef',\n UNION = 'union',\n UNKNOWN = 'unknown',\n}\n\nexport enum CodePrimitiveKind {\n STRING = 'string',\n NUMBER = 'number',\n BOOLEAN = 'boolean',\n DATE = 'date',\n DATETIME = 'datetime',\n TIME = 'time',\n MONEY = 'money',\n CODE = 'code',\n FILE = 'file',\n DURATION = 'duration',\n PHONE = 'phone',\n BIGDECIMAL = 'bigdecimal',\n UNKNOWN = 'unknown',\n}\n\n/**\n * Author-only metadata for array elements.\n *\n * `elementMeaning` (on `ArraySpecParams`) explains business semantics; this\n * shape captures the **author-only** overlays that the framework cannot\n * derive on its own: a public `enumDeclaration` for ENUM/UNION-of-ENUM\n * branches and free-form `notes`.\n *\n * This shape intentionally excludes `kind`, `primitiveType`,\n * `schemaDeclaration` and `foreignKeyTargetResource`. The schema and\n * relationship declarations already provide those structural facts, so\n * repeating them here would create two sources of truth.\n *\n * Authors keep `enumDeclaration` so the companion can render `Use member X\n * from ENUM_NAME imported via PACKAGE` lines without re-walking the enum\n * to find its public symbol — there is no Zod-side metadata that carries\n * the public import path. UNION branches that are themselves enums also\n * reuse the parent `enumDeclaration` (the dominant vocabulary).\n */\nexport interface ArrayElementTypeSpec {\n /** Named enum/const-object declaration when elements use a vocabulary. */\n enumDeclaration?: CodeSymbolRef;\n /** Extra caveats for downstream coding prompts. */\n notes?: string[];\n}\n\nexport interface FieldSpecBaseParams {\n /** Business meaning of the field: what it represents in the domain. */\n meaning: string;\n /** Why the AI should care about this field when authoring behavior or UI. */\n whyItMatters?: string;\n /** Relative weight of this field in the resource understanding. */\n importance?: FieldSemanticImportance;\n}\n\n//------------------------------------------------------------------------------------------------\n// STRING SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface StringSpecParams extends FieldSpecBaseParams {\n /** Semantic role of the string content in the domain. */\n semanticRole?: 'identifier' | 'name' | 'description' | 'content' | 'label' | 'code' | 'uri';\n}\n\n//------------------------------------------------------------------------------------------------\n// NUMBER SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface NumberSpecParams extends FieldSpecBaseParams {\n /** Business unit of the numeric value (e.g., \"days\", \"percentage\", \"count\"). */\n unit?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// BOOLEAN SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type BooleanSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// DATE / DATETIME / TIME SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface DateSpecParams extends FieldSpecBaseParams {\n /** Temporal semantic role (e.g., deadline, creation timestamp, expiration). */\n temporalRole?: 'deadline' | 'creation' | 'expiration' | 'scheduled' | 'occurred' | 'modified';\n}\n\nexport type DateTimeSpecParams = DateSpecParams;\nexport type TimeSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// ENUM SPEC\n//------------------------------------------------------------------------------------------------\n\n/** Per-value semantic meaning for an enum field. */\nexport interface EnumValueSpecConfig {\n /** What this enum value means in business terms. */\n meaning: string;\n}\n\nexport interface EnumSpecParams extends FieldSpecBaseParams {\n /** Per-value business semantics — keyed by enum value. */\n values?: Record<string, EnumValueSpecConfig>;\n /** Public declaration that owns the enum vocabulary. */\n enumDeclaration?: CodeSymbolRef;\n}\n\n//------------------------------------------------------------------------------------------------\n// MONEY SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type MoneySpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// CODE SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type CodeSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// FILE SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type FileSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// DURATION SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type DurationSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// PHONE SPEC\n//------------------------------------------------------------------------------------------------\n\nexport type PhoneSpecParams = FieldSpecBaseParams;\n\n//------------------------------------------------------------------------------------------------\n// BIGDECIMAL SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface BigDecimalSpecParams extends FieldSpecBaseParams {\n /** Business unit of the value (e.g., \"currency\", \"weight\", \"rate\"). */\n unit?: string;\n}\n\n//------------------------------------------------------------------------------------------------\n// FOREIGN KEY SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface ForeignKeySpecParams extends FieldSpecBaseParams {\n /** Business meaning of the relationship this FK represents. */\n relationshipContext?: string;\n /**\n * Target resource is no longer authored here.\n *\n * Schema interpretation derives the target by matching `foreignKeyField`\n * against the owning resource's relationship declarations. Author the\n * relationship and its field once in the application relationship\n * declaration; the specification then receives the resolved target without\n * a second, potentially conflicting field.\n */\n}\n\n//------------------------------------------------------------------------------------------------\n// ARRAY SPEC\n//------------------------------------------------------------------------------------------------\n\nexport interface ArraySpecParams extends FieldSpecBaseParams {\n /** Business meaning of each element in the collection. */\n elementMeaning?: string;\n /** Structural/code-handling description of each array element. */\n elementType?: ArrayElementTypeSpec;\n}\n\n//------------------------------------------------------------------------------------------------\n// OBJECT SPEC\n//------------------------------------------------------------------------------------------------\n\n/**\n * Object-spec params are intentionally identical to the base shape.\n *\n * The decorator keeps a distinct semantic identity (an `objectSpec()` call\n * marks a nested structure as field-spec-bearing for completeness checks),\n * but it carries no extra structural metadata: nested-structure shape and\n * any `schemaDeclaration` are derivable from the Zod object itself, and\n * `structureRole` overlapped with the base `meaning` field with no clear\n * delineation.\n *\n * The type intentionally adds no separate structural metadata: duplicating\n * the base semantics would make nested-object authoring ambiguous.\n */\nexport type ObjectSpecParams = FieldSpecBaseParams;\n/** @wildo_source:part:end zod.decorators.field-spec-params */\n\n\n// ==========================================================================================================================================================\n// ZOD DECORATOR TYPES\n// ==========================================================================================================================================================\n\n/**\n * @wildo_source:part:start zod.decorators.decorator-vocabulary\n *\n * Canonical string identifiers for framework Zod field decorators (`ZodDecorator` enum).\n */\nexport enum ZodDecorator {\n IS_DB_INDEXED = \"isDBIndexed\",\n IS_FOREIGN_KEY = \"isForeignKey\",\n IS_HIDDEN = \"isHidden\",\n IS_NOT_EDITABLE = \"isNotEditable\",\n // New decorators for resource derived objects rationalization\n IS_SUMMARY_FIELD = \"isSummaryField\",\n IS_BACKEND_ONLY = \"isBackendOnly\",\n IS_WRITE_ONLY_SECRET = \"isWriteOnlySecret\",\n /**\n * Impersonalization: per-field erasure-scrub treatment — a `RedactionType` value (string),\n * read by the saas-models impersonalize writer. NOT the anonymous-user concept.\n *\n * Authored fluently: `z.string().nullish().impersonalizeWith(RedactionType.REMOVE)`. The\n * treatment is REQUIRED and must be a non-empty string — a blank/missing value throws at\n * decoration time rather than silently leaving the field untreated (an unscrubbed personal\n * field). `addImpersonalizeWith(schema, treatment)` is the equivalent programmatic escape hatch;\n * read the treatment back with `getImpersonalizeTreatment(schema)`.\n *\n * A `MASK` treatment may carry a field-specific mask value —\n * `addImpersonalizeWith(schema, RedactionType.MASK, { maskValue: 'erased@erased.invalid' })` —\n * for a CONSTRAINED string the default mask constant cannot satisfy; read it back with\n * `getImpersonalizeMaskValue(schema)`. Both authoring doors normalize to\n * {@link ImpersonalizeFieldParams}, which is what this decorator stores.\n */\n IMPERSONALIZE_WITH = \"impersonalizeWith\",\n /**\n * Portability: where this field's value CAME FROM — a `DataPortabilityProvenance` value (string),\n * read by the subject-export orchestrator to decide GDPR Art. 20 scope.\n *\n * Authored fluently: `z.string().portabilityProvenance(DataPortabilityProvenance.SUBJECT_PROVIDED)`.\n * The value is REQUIRED and must be a non-empty string — a blank/missing value throws at\n * decoration time rather than storing an undeclared provenance, which an Art. 20 export treats as\n * a REFUSAL rather than guessing. `addPortabilityProvenance(schema, provenance)` is the equivalent\n * programmatic escape hatch; read it back with `getPortabilityProvenance(schema)`.\n *\n * A field that carries no declaration inherits its resource's `portabilityPolicy.defaultProvenance`;\n * only fields differing from that default need this decorator.\n *\n * ⚠️ NOT a redaction or scrub concept, and NOT the anonymous-user concept. This says where a value\n * ORIGINATED, for a DISCLOSURE decision. What happens to a value on ERASURE is\n * {@link ZodDecorator.IMPERSONALIZE_WITH}, an orthogonal axis — a field is commonly both\n * `SUBJECT_PROVIDED` and masked on erasure.\n */\n PORTABILITY_PROVENANCE = \"portabilityProvenance\",\n /**\n * Data categories: WHICH KINDS of personal data this field holds — one or more\n * `PersonalDataCategory` values (strings), read by the compliance fact producer to answer the\n * privacy-notice question \"which categories of personal data do you process\".\n *\n * Authored fluently: `email: z.email().dataCategories(PersonalDataCategory.CONTACT_DETAILS)`, or\n * with an array when a field genuinely spans two —\n * `.dataCategories([PersonalDataCategory.USER_CONTENT, PersonalDataCategory.SPECIAL_CATEGORY_HEALTH])`.\n * The chokepoint normalizes either form to a deduped array, so every reader sees one shape.\n * At least one category is REQUIRED and each must be a non-empty string: a blank declaration\n * would read back as declared-but-meaningless, which is worse than absent, because absence is\n * what the gap report is looking for. `addDataCategories(schema, categories)` is the equivalent\n * programmatic escape hatch; read them back with `getDataCategories(schema)`.\n *\n * WHETHER each value is a real `PersonalDataCategory` member is checked by the resource factory's\n * boot guard, which owns the enum — this layer knows only that non-empty strings were declared.\n *\n * ⚠️ Four adjacent axes, none of them this one. {@link ZodDecorator.IMPERSONALIZE_WITH} says what\n * happens to the value on ERASURE; {@link ZodDecorator.PORTABILITY_PROVENANCE} says where it CAME\n * FROM; `Compliance_DataClassification` is a SENSITIVITY ladder for flows-actors config; a\n * retention class says HOW LONG it is kept. A single field is routinely all five at once, and\n * none of the other four can answer \"what kind of personal data is this\".\n *\n * ⚠️ Do NOT declare a category on a field merely because its NAME suggests one. The decorator\n * exists precisely so categories are never derived from identifiers: `email`, `phone` and\n * `dateOfBirth` are suggestive while `notes` is not, and an inventory assembled by\n * pattern-matching names is a guess whose misses are silently undisclosed. `CREDENTIALS` is the\n * one category the producer derives, and it derives it from `.isPassword()` / `.isOtp()` /\n * `.isWriteOnlySecret()` — markers the author wrote, not names it read.\n *\n * assurance-control: WILDO.PRIVACY.PERSONAL_DATA_INVENTORY — the application declares which\n * categories of personal data each field holds\n */\n DATA_CATEGORIES = \"dataCategories\",\n /**\n * Audit evidence: this field's BEFORE/AFTER VALUES are recorded when a resource operation\n * mutates it, on the `resource_operation_performed` audit event.\n *\n * Authored fluently: `appRoles: z.array(z.string()).isAuditEvidence()`. A pure marker — no\n * parameters, no implied decorators. `addAuditEvidence(schema)` is the equivalent programmatic\n * escape hatch; read it back with `isAuditEvidenceField(schema)`.\n *\n * **Mark the fields whose VALUES are the evidence, and only those.** The audit event always\n * records the NAMES of every changed field (a field name is not personal data). This marker adds\n * the values, and values are the part that must be justified: audit rows replicate to the per-org\n * SIEM and to the immutable ledger, and the ledger cannot be scrubbed — so marking a personal-data\n * field manufactures an unerasable copy of it, defeating the impersonalization/retention\n * capability. Mark authority (`appRoles`, `roles`), lifecycle state (`status`), and scope-bearing\n * fields; do NOT mark names, contact details, addresses, free text, or anything a data subject\n * could ask to have erased.\n *\n * ⚠️ This is a WRITE-side claim — \"when this field CHANGES, the change itself is evidence\" — and\n * is independent of the READ-side disclosure trail. The framework has exactly two disclosure\n * triggers: `isBackendOnly({ isReturnedAtCreation: true })`, which fires one `FIELD_ACCESS` event\n * when a server-minted secret is first exposed on a create, and `.isEphemeral()`, which fires on\n * any operation so a rotate or regenerate is recorded as well. A field can carry any combination\n * of the three markers. There is still no general \"audit every read of this field\" marker; do not\n * go looking for one.\n *\n * assurance-control: WILDO.SECRETS.DISCLOSURE_AUDIT\n */\n IS_AUDIT_EVIDENCE = \"isAuditEvidence\",\n /**\n * RAG source: this field's TEXT is a retrieval-corpus source. The framework chunks the value\n * (extracting text first for file fields), stores the chunks in the application's OWN datastore\n * (pgvector on PostgreSQL, `$vectorSearch` on MongoDB — never a third store), and erases them\n * with the row: chunks are a derived-data tier keyed `(resourceType, resourceId, fieldName)`,\n * so row deletion, field impersonalization, and subject erasure all reach them.\n *\n * Authored fluently: `z.string().ragSource()` or `z.string().ragSource({ chunkingStrategy:\n * RAGChunkingStrategy.MARKDOWN, chunkSize: 1200, chunkOverlap: 150 })`. All params are optional\n * and there is NO `enabled` flag — presence of the decorator IS the declaration (see\n * {@link RagSourceConfiguration}). `addRagSource(schema, config?)` is the equivalent programmatic\n * escape hatch; read the config back with `getRagSourceConfig(schema)`.\n *\n * **File fields are one text provider, not a separate mechanism.** `z_file({ ragSource: {...} })`\n * registers THIS decorator on the schema it returns, so detection is uniform across plain-text\n * and file-backed sources; file-only extraction knobs (OCR) live file-side in\n * `FileSchemaOptions.textExtraction`, never here.\n *\n * **Refused companions, enforced in BOTH application orders at the decorator chokepoint:**\n * - {@link ZodDecorator.IS_PASSWORD}, {@link ZodDecorator.IS_OTP},\n * {@link ZodDecorator.IS_WRITE_ONLY_SECRET}, {@link ZodDecorator.IS_EPHEMERAL} — a secret or\n * ephemeral value must never enter a retrieval corpus.\n * - {@link ZodDecorator.TTL} — MongoDB honours `.ttl()` natively: rows vanish with NO application\n * code running, so derived chunks of a TTL row could never be erased with their parent (plan\n * `resource-rag-capability` DL3). The refusal lifts when a sweep-cascade reconciles chunk rows\n * against vanished parents.\n *\n * {@link ZodDecorator.IS_BACKEND_ONLY} composes: a backend-only field can be a corpus source —\n * retrieval access is governed by the resource's own access binding, not by field visibility.\n * {@link ZodDecorator.IMPERSONALIZE_WITH} composes too: an impersonalize decision deletes the\n * field's chunks in the same decision.\n */\n RAG_SOURCE = \"ragSource\",\n IS_VIRTUAL = \"isVirtual\",\n IS_DISCRIMINATOR = \"isDiscriminator\",\n EXCLUDE_FROM_CREATE = \"excludeFromCreate\",\n EXCLUDE_FROM_UPDATE = \"excludeFromUpdate\",\n // Database constraint decorators\n IS_UNIQUE = \"isUnique\",\n IS_PRIMARY_KEY = \"isPrimaryKey\",\n /**\n * Marks a field as a stable, declaration-side **business key** —\n * an identity independent from the random `_id` (`isPrimaryKey`).\n *\n * Used by data seeding to safely upsert, upgrade and synchronize seeded rows.\n * Unlike `isPrimaryKey`,\n * a business key is mutable by users (renames are handled by a per-seed\n * `renames: [{ from, to }]` migrator), and it carries no implicit\n * decorators (`isPrimaryKey` is composite — `isBusinessKey` is purely\n * a marker so it can co-exist with whatever editing semantics the field\n * already has).\n *\n * Composite scope-aware identity uses the object-level\n * `OBJECT_BUSINESS_KEY_SET` decorator on the schema root.\n */\n IS_BUSINESS_KEY = \"isBusinessKey\",\n /**\n * Object-level decorator declaring a **composite business key** for the\n * schema (e.g. `(organizationId, templateKey)`). Schema-level analog of\n * `IS_BUSINESS_KEY`. Used by the data-seeding subsystem.\n *\n * Field-level `IS_BUSINESS_KEY` and object-level `OBJECT_BUSINESS_KEY_SET`\n * are **mutually exclusive** on the same schema — pick one identity model\n * (single field vs composite). Mixing is rejected at decoration time.\n */\n OBJECT_BUSINESS_KEY_SET = \"businessKeySet\",\n TTL = \"ttl\",\n // String edit mode convenience decorators (shorthand for STRING_UI with specific editMode)\n IS_PASSWORD = \"isPassword\",\n IS_OTP = \"isOtp\",\n IS_COLOR = \"isColor\",\n // Form validation decorators\n IS_DRAFT_RELAXED = \"isDraftRelaxed\",\n // FIX-P5-H1: Conditional visibility decorator\n SHOW_WHEN = \"showWhen\",\n // System enum decorator - marks an enum field as using a system-level enum (currency, language, country, etc.)\n SYSTEM_ENUM = \"systemEnum\",\n // Ephemeral field decorator - marks a field as transient response-only data (shown once, then gone)\n IS_EPHEMERAL = \"isEphemeral\",\n // CRDT field decorator — marks a field for future field-level LWW merge.\n IS_CRDT = \"isCRDT\",\n // Unified {primitive}UI decorators — new API replacing display policy + formField decomposition\n BOOLEAN_UI = \"booleanUI\",\n STRING_UI = \"stringUI\",\n NUMBER_UI = \"numberUI\",\n ENUM_UI = \"enumUI\",\n DATE_UI = \"dateUI\",\n DATETIME_UI = \"dateTimeUI\",\n TIME_UI = \"timeUI\",\n MONEY_UI = \"moneyUI\",\n CODE_UI = \"codeUI\",\n FILE_UI = \"fileUI\",\n DURATION_UI = \"durationUI\",\n PHONE_UI = \"phoneUI\",\n BIGDECIMAL_UI = \"bigDecimalUI\",\n FOREIGN_KEY_UI = \"foreignKeyUI\",\n ARRAY_UI = \"arrayUI\",\n OBJECT_UI = \"objectUI\",\n // Per-primitive field specification decorators — business semantics (companion-only)\n STRING_SPEC = \"stringSpec\",\n NUMBER_SPEC = \"numberSpec\",\n BOOLEAN_SPEC = \"booleanSpec\",\n DATE_SPEC = \"dateSpec\",\n DATETIME_SPEC = \"dateTimeSpec\",\n TIME_SPEC = \"timeSpec\",\n ENUM_SPEC = \"enumSpec\",\n MONEY_SPEC = \"moneySpec\",\n CODE_SPEC = \"codeSpec\",\n FILE_SPEC = \"fileSpec\",\n DURATION_SPEC = \"durationSpec\",\n PHONE_SPEC = \"phoneSpec\",\n BIGDECIMAL_SPEC = \"bigDecimalSpec\",\n FOREIGN_KEY_SPEC = \"foreignKeySpec\",\n ARRAY_SPEC = \"arraySpec\",\n OBJECT_SPEC = \"objectSpec\",\n}\n\n// Custom field metadata stored on Zod schemas via decorators.\n// It represents all possible metadata that can be attached to a schema.\n// NOTE: The main CustomFieldMetadata interface is defined after ZodDecorator_Types\n// to properly reference the types from ZodDecorator_Types.\n\nexport type ZodDecorator_ParamsType = {\n [ZodDecorator.IS_DB_INDEXED]: undefined;\n [ZodDecorator.IS_FOREIGN_KEY]: ForeignKeyStructuralParams | DecoratorUpdater<ForeignKeyStructuralParams> | undefined;\n [ZodDecorator.IS_HIDDEN]: HiddenFieldParams | DecoratorUpdater<HiddenFieldParams> | undefined;\n [ZodDecorator.IS_NOT_EDITABLE]: NotEditableFieldParams | DecoratorUpdater<NotEditableFieldParams> | undefined;\n // New decorators for resource derived objects rationalization\n [ZodDecorator.IS_SUMMARY_FIELD]: SummaryFieldParams | DecoratorUpdater<SummaryFieldParams> | undefined;\n [ZodDecorator.IS_BACKEND_ONLY]: BackendOnlyFieldParams | DecoratorUpdater<BackendOnlyFieldParams> | undefined;\n [ZodDecorator.IS_WRITE_ONLY_SECRET]: WriteOnlySecretFieldParams | DecoratorUpdater<WriteOnlySecretFieldParams> | undefined;\n /**\n * The field's impersonalization treatment. Accepts BOTH authored forms — a bare `RedactionType`\n * value (the common case) or the full {@link ImpersonalizeFieldParams} object when a `MASK` needs\n * a field-specific `maskValue`. The decorator chokepoint normalizes either to the params object.\n * The treatment is typed as a plain string at this layer (zod-decorators sits below saas-models\n * and cannot import `RedactionType`).\n */\n [ZodDecorator.IMPERSONALIZE_WITH]: string | ImpersonalizeFieldParams;\n /**\n * The field's portability provenance — a `DataPortabilityProvenance` value, typed as a plain\n * string at this layer (zod-decorators sits below saas-models and cannot import the enum). One\n * datum, so unlike {@link ZodDecorator.IMPERSONALIZE_WITH} there is no object authoring form to\n * normalize; if a second axis is ever needed the chokepoint widens exactly as that one did.\n */\n [ZodDecorator.PORTABILITY_PROVENANCE]: string;\n /**\n * The field's personal-data categories — `PersonalDataCategory` values, typed as plain strings at\n * this layer (zod-decorators sits below saas-models and cannot import the enum). Accepts a single\n * value (the common case) or an array; the chokepoint normalizes either to a deduped array.\n */\n [ZodDecorator.DATA_CATEGORIES]: string | readonly string[];\n // Audit-evidence marker — parameterless, like IS_BUSINESS_KEY. A field either is evidence or is\n // not; there is no axis to parameterize, and adding one would invite per-field redaction policy\n // to grow here instead of on the impersonalization decorator that owns it.\n [ZodDecorator.IS_AUDIT_EVIDENCE]: undefined;\n /**\n * RAG-source declaration. The config object is optional — `.ragSource()` with no argument is a\n * complete declaration — and the chokepoint normalizes an omitted config to `{}` so every reader\n * sees one stored shape (see {@link ZodDecorator_Types}).\n */\n [ZodDecorator.RAG_SOURCE]: RagSourceConfiguration | undefined;\n [ZodDecorator.IS_VIRTUAL]: VirtualFieldParams | DecoratorUpdater<VirtualFieldParams>;\n [ZodDecorator.IS_DISCRIMINATOR]: DiscriminatorFieldParams | DecoratorUpdater<DiscriminatorFieldParams> | undefined;\n [ZodDecorator.EXCLUDE_FROM_CREATE]: undefined;\n [ZodDecorator.EXCLUDE_FROM_UPDATE]: undefined;\n // Database constraint decorators\n [ZodDecorator.IS_UNIQUE]: UniqueFieldParams | DecoratorUpdater<UniqueFieldParams> | undefined;\n [ZodDecorator.IS_PRIMARY_KEY]: undefined;\n // Business key marker (parameterless field-level marker for the data-seeding subsystem)\n [ZodDecorator.IS_BUSINESS_KEY]: undefined;\n // Composite business key (object-level decorator carrying the ordered list of field names)\n [ZodDecorator.OBJECT_BUSINESS_KEY_SET]: BusinessKeySetParams | DecoratorUpdater<BusinessKeySetParams>;\n [ZodDecorator.TTL]: TtlFieldParams | DecoratorUpdater<TtlFieldParams>;\n // String edit mode convenience decorators\n [ZodDecorator.IS_PASSWORD]: undefined;\n [ZodDecorator.IS_OTP]: OtpFieldParams | DecoratorUpdater<OtpFieldParams> | undefined;\n [ZodDecorator.IS_COLOR]: undefined;\n // Form validation decorators\n [ZodDecorator.IS_DRAFT_RELAXED]: undefined;\n // FIX-P5-H1: Conditional visibility decorator\n [ZodDecorator.SHOW_WHEN]: ShowWhenParams | DecoratorUpdater<ShowWhenParams>;\n // System enum decorator — the param is the system enum name string (e.g. 'AvailableCurrency')\n [ZodDecorator.SYSTEM_ENUM]: string;\n // Ephemeral field decorator — marks response-only transient data (API keys, tokens, etc.)\n [ZodDecorator.IS_EPHEMERAL]: undefined;\n // CRDT field decorator — boolean marker, no parameters\n [ZodDecorator.IS_CRDT]: undefined;\n // Unified {primitive}UI decorators — all accept their respective UIParams or a DecoratorUpdater\n [ZodDecorator.BOOLEAN_UI]: BooleanUIParams | DecoratorUpdater<BooleanUIParams> | undefined;\n [ZodDecorator.STRING_UI]: StringUIParams | DecoratorUpdater<StringUIParams> | undefined;\n [ZodDecorator.NUMBER_UI]: NumberUIParams | DecoratorUpdater<NumberUIParams> | undefined;\n [ZodDecorator.ENUM_UI]: EnumUIParams | DecoratorUpdater<EnumUIParams> | undefined;\n [ZodDecorator.DATE_UI]: DateUIParams | DecoratorUpdater<DateUIParams> | undefined;\n [ZodDecorator.DATETIME_UI]: DateTimeUIParams | DecoratorUpdater<DateTimeUIParams> | undefined;\n [ZodDecorator.TIME_UI]: TimeUIParams | DecoratorUpdater<TimeUIParams> | undefined;\n [ZodDecorator.MONEY_UI]: MoneyUIParams | DecoratorUpdater<MoneyUIParams> | undefined;\n [ZodDecorator.CODE_UI]: CodeUIParams | DecoratorUpdater<CodeUIParams> | undefined;\n [ZodDecorator.FILE_UI]: FileUIParams | DecoratorUpdater<FileUIParams> | undefined;\n [ZodDecorator.DURATION_UI]: DurationUIParams | DecoratorUpdater<DurationUIParams> | undefined;\n [ZodDecorator.PHONE_UI]: PhoneUIParams | DecoratorUpdater<PhoneUIParams> | undefined;\n [ZodDecorator.BIGDECIMAL_UI]: BigDecimalUIParams | DecoratorUpdater<BigDecimalUIParams> | undefined;\n [ZodDecorator.FOREIGN_KEY_UI]: ForeignKeyUIParams | DecoratorUpdater<ForeignKeyUIParams> | undefined;\n [ZodDecorator.ARRAY_UI]: ArrayUIParams | DecoratorUpdater<ArrayUIParams> | undefined;\n [ZodDecorator.OBJECT_UI]: ObjectUIParams | DecoratorUpdater<ObjectUIParams> | undefined;\n // Per-primitive field specification decorators\n [ZodDecorator.STRING_SPEC]: StringSpecParams | DecoratorUpdater<StringSpecParams> | undefined;\n [ZodDecorator.NUMBER_SPEC]: NumberSpecParams | DecoratorUpdater<NumberSpecParams> | undefined;\n [ZodDecorator.BOOLEAN_SPEC]: BooleanSpecParams | DecoratorUpdater<BooleanSpecParams> | undefined;\n [ZodDecorator.DATE_SPEC]: DateSpecParams | DecoratorUpdater<DateSpecParams> | undefined;\n [ZodDecorator.DATETIME_SPEC]: DateTimeSpecParams | DecoratorUpdater<DateTimeSpecParams> | undefined;\n [ZodDecorator.TIME_SPEC]: TimeSpecParams | DecoratorUpdater<TimeSpecParams> | undefined;\n [ZodDecorator.ENUM_SPEC]: EnumSpecParams | DecoratorUpdater<EnumSpecParams> | undefined;\n [ZodDecorator.MONEY_SPEC]: MoneySpecParams | DecoratorUpdater<MoneySpecParams> | undefined;\n [ZodDecorator.CODE_SPEC]: CodeSpecParams | DecoratorUpdater<CodeSpecParams> | undefined;\n [ZodDecorator.FILE_SPEC]: FileSpecParams | DecoratorUpdater<FileSpecParams> | undefined;\n [ZodDecorator.DURATION_SPEC]: DurationSpecParams | DecoratorUpdater<DurationSpecParams> | undefined;\n [ZodDecorator.PHONE_SPEC]: PhoneSpecParams | DecoratorUpdater<PhoneSpecParams> | undefined;\n [ZodDecorator.BIGDECIMAL_SPEC]: BigDecimalSpecParams | DecoratorUpdater<BigDecimalSpecParams> | undefined;\n [ZodDecorator.FOREIGN_KEY_SPEC]: ForeignKeySpecParams | DecoratorUpdater<ForeignKeySpecParams> | undefined;\n [ZodDecorator.ARRAY_SPEC]: ArraySpecParams | DecoratorUpdater<ArraySpecParams> | undefined;\n [ZodDecorator.OBJECT_SPEC]: ObjectSpecParams | DecoratorUpdater<ObjectSpecParams> | undefined;\n}\n\n\n\nexport type ZodDecorator_Types = {\n [ZodDecorator.IS_DB_INDEXED]: boolean;\n [ZodDecorator.IS_FOREIGN_KEY]: ForeignKeyStructuralParams | true;\n [ZodDecorator.IS_HIDDEN]: HiddenFieldParams | true;\n [ZodDecorator.IS_NOT_EDITABLE]: NotEditableFieldParams | true;\n // New decorators for resource derived objects rationalization\n [ZodDecorator.IS_SUMMARY_FIELD]: SummaryFieldParams | true;\n [ZodDecorator.IS_BACKEND_ONLY]: BackendOnlyFieldParams | true;\n [ZodDecorator.IS_WRITE_ONLY_SECRET]: WriteOnlySecretFieldParams | true;\n /** Impersonalization scrub params — the treatment (a `RedactionType` value carried as an opaque\n * `string`, since zod-decorators sits below saas-models) plus an optional `MASK` override value.\n * ALWAYS the normalized object: the chokepoint widens a bare-string authoring form on the way in,\n * so every reader sees one shape. */\n [ZodDecorator.IMPERSONALIZE_WITH]: ImpersonalizeFieldParams;\n /** Portability provenance — a `DataPortabilityProvenance` value carried as an opaque `string`\n * (zod-decorators sits below saas-models). Stored exactly as authored; the chokepoint only\n * rejects blanks. */\n [ZodDecorator.PORTABILITY_PROVENANCE]: string;\n /** Personal-data categories — `PersonalDataCategory` values carried as opaque `string`s\n * (zod-decorators sits below saas-models). ALWAYS the normalized array, deduped and non-empty:\n * the chokepoint widens a bare single-value authoring form on the way in, so every reader sees\n * one shape and `getDataCategories` can answer \"is this field categorized?\" by presence alone. */\n [ZodDecorator.DATA_CATEGORIES]: readonly string[];\n /** Audit-evidence marker — stored as the bare `true` sentinel (parameterless, like IS_BUSINESS_KEY). */\n [ZodDecorator.IS_AUDIT_EVIDENCE]: true;\n /** RAG-source config — ALWAYS the normalized object ( `{}` when authored with no argument): the\n * chokepoint validates and normalizes on the way in, so every reader sees one shape and\n * `getRagSourceConfig` can answer \"is this field a source?\" by presence alone. */\n [ZodDecorator.RAG_SOURCE]: RagSourceConfiguration;\n [ZodDecorator.IS_VIRTUAL]: VirtualFieldParams;\n [ZodDecorator.IS_DISCRIMINATOR]: DiscriminatorFieldParams | true;\n [ZodDecorator.EXCLUDE_FROM_CREATE]: true;\n [ZodDecorator.EXCLUDE_FROM_UPDATE]: true;\n // Database constraint decorators\n [ZodDecorator.IS_UNIQUE]: UniqueFieldParams | true;\n [ZodDecorator.IS_PRIMARY_KEY]: true;\n // Business key marker (parameterless field-level marker for the data-seeding subsystem)\n [ZodDecorator.IS_BUSINESS_KEY]: true;\n // Composite business key (object-level — stored params shape after resolver unwraps DecoratorUpdater)\n [ZodDecorator.OBJECT_BUSINESS_KEY_SET]: BusinessKeySetParams;\n [ZodDecorator.TTL]: TtlFieldParams;\n // String edit mode convenience decorators\n [ZodDecorator.IS_PASSWORD]: true;\n [ZodDecorator.IS_OTP]: OtpFieldParams | true;\n [ZodDecorator.IS_COLOR]: true;\n // Form validation decorators\n [ZodDecorator.IS_DRAFT_RELAXED]: true;\n // FIX-P5-H1: Conditional visibility decorator\n [ZodDecorator.SHOW_WHEN]: ShowWhenParams;\n // System enum decorator\n [ZodDecorator.SYSTEM_ENUM]: string;\n // Ephemeral field decorator\n [ZodDecorator.IS_EPHEMERAL]: true;\n // CRDT field decorator\n [ZodDecorator.IS_CRDT]: true;\n // Unified {primitive}UI decorators — stored types (after resolver unwraps DecoratorUpdater)\n [ZodDecorator.BOOLEAN_UI]: BooleanUIParams;\n [ZodDecorator.STRING_UI]: StringUIParams;\n [ZodDecorator.NUMBER_UI]: NumberUIParams;\n [ZodDecorator.ENUM_UI]: EnumUIParams;\n [ZodDecorator.DATE_UI]: DateUIParams;\n [ZodDecorator.DATETIME_UI]: DateTimeUIParams;\n [ZodDecorator.TIME_UI]: TimeUIParams;\n [ZodDecorator.MONEY_UI]: MoneyUIParams;\n [ZodDecorator.CODE_UI]: CodeUIParams;\n [ZodDecorator.FILE_UI]: FileUIParams;\n [ZodDecorator.DURATION_UI]: DurationUIParams;\n [ZodDecorator.PHONE_UI]: PhoneUIParams;\n [ZodDecorator.BIGDECIMAL_UI]: BigDecimalUIParams;\n [ZodDecorator.FOREIGN_KEY_UI]: ForeignKeyUIParams;\n [ZodDecorator.ARRAY_UI]: ArrayUIParams;\n [ZodDecorator.OBJECT_UI]: ObjectUIParams;\n // Per-primitive field specification decorators\n [ZodDecorator.STRING_SPEC]: StringSpecParams;\n [ZodDecorator.NUMBER_SPEC]: NumberSpecParams;\n [ZodDecorator.BOOLEAN_SPEC]: BooleanSpecParams;\n [ZodDecorator.DATE_SPEC]: DateSpecParams;\n [ZodDecorator.DATETIME_SPEC]: DateTimeSpecParams;\n [ZodDecorator.TIME_SPEC]: TimeSpecParams;\n [ZodDecorator.ENUM_SPEC]: EnumSpecParams;\n [ZodDecorator.MONEY_SPEC]: MoneySpecParams;\n [ZodDecorator.CODE_SPEC]: CodeSpecParams;\n [ZodDecorator.FILE_SPEC]: FileSpecParams;\n [ZodDecorator.DURATION_SPEC]: DurationSpecParams;\n [ZodDecorator.PHONE_SPEC]: PhoneSpecParams;\n [ZodDecorator.BIGDECIMAL_SPEC]: BigDecimalSpecParams;\n [ZodDecorator.FOREIGN_KEY_SPEC]: ForeignKeySpecParams;\n [ZodDecorator.ARRAY_SPEC]: ArraySpecParams;\n [ZodDecorator.OBJECT_SPEC]: ObjectSpecParams;\n}\n/** @wildo_source:part:end zod.decorators.decorator-vocabulary */\n\n/**\n * @wildo_source:part:start zod.decorators.schema-metadata\n *\n * Per-field decorator metadata bag stored on schema instances under `SCHEMA_METADATA`.\n */\nexport interface CustomFieldMetadata {\n [ZodDecorator.IS_DB_INDEXED]?: ZodDecorator_Types[ZodDecorator.IS_DB_INDEXED];\n [ZodDecorator.IS_FOREIGN_KEY]?: ZodDecorator_Types[ZodDecorator.IS_FOREIGN_KEY];\n [ZodDecorator.IS_HIDDEN]?: ZodDecorator_Types[ZodDecorator.IS_HIDDEN];\n [ZodDecorator.IS_NOT_EDITABLE]?: ZodDecorator_Types[ZodDecorator.IS_NOT_EDITABLE];\n // New decorators for resource derived objects rationalization\n [ZodDecorator.IS_SUMMARY_FIELD]?: ZodDecorator_Types[ZodDecorator.IS_SUMMARY_FIELD];\n [ZodDecorator.IS_BACKEND_ONLY]?: ZodDecorator_Types[ZodDecorator.IS_BACKEND_ONLY];\n [ZodDecorator.IS_WRITE_ONLY_SECRET]?: ZodDecorator_Types[ZodDecorator.IS_WRITE_ONLY_SECRET];\n [ZodDecorator.IMPERSONALIZE_WITH]?: ZodDecorator_Types[ZodDecorator.IMPERSONALIZE_WITH];\n [ZodDecorator.PORTABILITY_PROVENANCE]?: ZodDecorator_Types[ZodDecorator.PORTABILITY_PROVENANCE];\n [ZodDecorator.DATA_CATEGORIES]?: ZodDecorator_Types[ZodDecorator.DATA_CATEGORIES];\n [ZodDecorator.IS_AUDIT_EVIDENCE]?: ZodDecorator_Types[ZodDecorator.IS_AUDIT_EVIDENCE];\n [ZodDecorator.RAG_SOURCE]?: ZodDecorator_Types[ZodDecorator.RAG_SOURCE];\n [ZodDecorator.IS_VIRTUAL]?: ZodDecorator_Types[ZodDecorator.IS_VIRTUAL];\n [ZodDecorator.IS_DISCRIMINATOR]?: ZodDecorator_Types[ZodDecorator.IS_DISCRIMINATOR];\n [ZodDecorator.EXCLUDE_FROM_CREATE]?: ZodDecorator_Types[ZodDecorator.EXCLUDE_FROM_CREATE];\n [ZodDecorator.EXCLUDE_FROM_UPDATE]?: ZodDecorator_Types[ZodDecorator.EXCLUDE_FROM_UPDATE];\n // Database constraint decorators\n [ZodDecorator.IS_UNIQUE]?: ZodDecorator_Types[ZodDecorator.IS_UNIQUE];\n [ZodDecorator.IS_PRIMARY_KEY]?: ZodDecorator_Types[ZodDecorator.IS_PRIMARY_KEY];\n [ZodDecorator.IS_BUSINESS_KEY]?: ZodDecorator_Types[ZodDecorator.IS_BUSINESS_KEY];\n [ZodDecorator.OBJECT_BUSINESS_KEY_SET]?: ZodDecorator_Types[ZodDecorator.OBJECT_BUSINESS_KEY_SET];\n [ZodDecorator.TTL]?: ZodDecorator_Types[ZodDecorator.TTL];\n // String edit mode convenience decorators\n [ZodDecorator.IS_PASSWORD]?: ZodDecorator_Types[ZodDecorator.IS_PASSWORD];\n [ZodDecorator.IS_OTP]?: ZodDecorator_Types[ZodDecorator.IS_OTP];\n [ZodDecorator.IS_COLOR]?: ZodDecorator_Types[ZodDecorator.IS_COLOR];\n // Form validation decorators\n [ZodDecorator.IS_DRAFT_RELAXED]?: ZodDecorator_Types[ZodDecorator.IS_DRAFT_RELAXED];\n // FIX-P5-H1: Conditional visibility decorator\n [ZodDecorator.SHOW_WHEN]?: ZodDecorator_Types[ZodDecorator.SHOW_WHEN];\n // System enum decorator\n [ZodDecorator.SYSTEM_ENUM]?: ZodDecorator_Types[ZodDecorator.SYSTEM_ENUM];\n // Ephemeral field decorator\n [ZodDecorator.IS_EPHEMERAL]?: ZodDecorator_Types[ZodDecorator.IS_EPHEMERAL];\n // CRDT field decorator\n [ZodDecorator.IS_CRDT]?: ZodDecorator_Types[ZodDecorator.IS_CRDT];\n // Unified {primitive}UI decorators\n [ZodDecorator.BOOLEAN_UI]?: ZodDecorator_Types[ZodDecorator.BOOLEAN_UI];\n [ZodDecorator.STRING_UI]?: ZodDecorator_Types[ZodDecorator.STRING_UI];\n [ZodDecorator.NUMBER_UI]?: ZodDecorator_Types[ZodDecorator.NUMBER_UI];\n [ZodDecorator.ENUM_UI]?: ZodDecorator_Types[ZodDecorator.ENUM_UI];\n [ZodDecorator.DATE_UI]?: ZodDecorator_Types[ZodDecorator.DATE_UI];\n [ZodDecorator.DATETIME_UI]?: ZodDecorator_Types[ZodDecorator.DATETIME_UI];\n [ZodDecorator.TIME_UI]?: ZodDecorator_Types[ZodDecorator.TIME_UI];\n [ZodDecorator.MONEY_UI]?: ZodDecorator_Types[ZodDecorator.MONEY_UI];\n [ZodDecorator.CODE_UI]?: ZodDecorator_Types[ZodDecorator.CODE_UI];\n [ZodDecorator.FILE_UI]?: ZodDecorator_Types[ZodDecorator.FILE_UI];\n [ZodDecorator.DURATION_UI]?: ZodDecorator_Types[ZodDecorator.DURATION_UI];\n [ZodDecorator.PHONE_UI]?: ZodDecorator_Types[ZodDecorator.PHONE_UI];\n [ZodDecorator.BIGDECIMAL_UI]?: ZodDecorator_Types[ZodDecorator.BIGDECIMAL_UI];\n [ZodDecorator.FOREIGN_KEY_UI]?: ZodDecorator_Types[ZodDecorator.FOREIGN_KEY_UI];\n [ZodDecorator.ARRAY_UI]?: ZodDecorator_Types[ZodDecorator.ARRAY_UI];\n [ZodDecorator.OBJECT_UI]?: ZodDecorator_Types[ZodDecorator.OBJECT_UI];\n // Per-primitive field specification decorators\n [ZodDecorator.STRING_SPEC]?: ZodDecorator_Types[ZodDecorator.STRING_SPEC];\n [ZodDecorator.NUMBER_SPEC]?: ZodDecorator_Types[ZodDecorator.NUMBER_SPEC];\n [ZodDecorator.BOOLEAN_SPEC]?: ZodDecorator_Types[ZodDecorator.BOOLEAN_SPEC];\n [ZodDecorator.DATE_SPEC]?: ZodDecorator_Types[ZodDecorator.DATE_SPEC];\n [ZodDecorator.DATETIME_SPEC]?: ZodDecorator_Types[ZodDecorator.DATETIME_SPEC];\n [ZodDecorator.TIME_SPEC]?: ZodDecorator_Types[ZodDecorator.TIME_SPEC];\n [ZodDecorator.ENUM_SPEC]?: ZodDecorator_Types[ZodDecorator.ENUM_SPEC];\n [ZodDecorator.MONEY_SPEC]?: ZodDecorator_Types[ZodDecorator.MONEY_SPEC];\n [ZodDecorator.CODE_SPEC]?: ZodDecorator_Types[ZodDecorator.CODE_SPEC];\n [ZodDecorator.FILE_SPEC]?: ZodDecorator_Types[ZodDecorator.FILE_SPEC];\n [ZodDecorator.DURATION_SPEC]?: ZodDecorator_Types[ZodDecorator.DURATION_SPEC];\n [ZodDecorator.PHONE_SPEC]?: ZodDecorator_Types[ZodDecorator.PHONE_SPEC];\n [ZodDecorator.BIGDECIMAL_SPEC]?: ZodDecorator_Types[ZodDecorator.BIGDECIMAL_SPEC];\n [ZodDecorator.FOREIGN_KEY_SPEC]?: ZodDecorator_Types[ZodDecorator.FOREIGN_KEY_SPEC];\n [ZodDecorator.ARRAY_SPEC]?: ZodDecorator_Types[ZodDecorator.ARRAY_SPEC];\n [ZodDecorator.OBJECT_SPEC]?: ZodDecorator_Types[ZodDecorator.OBJECT_SPEC];\n /** Range schema type (only present for range schemas) */\n rangeType?: RangeType;\n /** Full range schema configuration (only present for range schemas) */\n rangeConfig?: RangeSchemaMetadata;\n /** Currency schema configuration (only present for currency schemas) */\n moneyConfig?: MoneySchemaMetadata;\n /** BigDecimal schema configuration (only present for bigdecimal schemas) */\n bigDecimalConfig?: BigDecimalSchemaMetadata;\n /** Duration schema configuration (only present for duration schemas) */\n durationConfig?: DurationSchemaMetadata;\n /** Phone schema configuration (only present for phone schemas) */\n phoneConfig?: PhoneSchemaMetadata;\n /** Code schema configuration (only present for code schemas) */\n codeConfig?: CodeSchemaMetadata;\n /** File schema configuration (only present for file schemas) */\n fileConfig?: FileSchemaMetadata;\n /** Versioned schema configuration (only present for versioned schemas) */\n versionedConfig?: VersionedSchemaMetadata;\n /** Versioned foreign key configuration (only present for versioned foreign key schemas) */\n versionedForeignKeyConfig?: VersionedForeignKeySchemaMetadata;\n}\n/** @wildo_source:part:end zod.decorators.schema-metadata */\n\n\n\n\n//================================================\n// ZOD TYPE COMPATIBILITY\n//================================================\n// Get types from instances for Zod v4 compatibility\ntype ZodenumInstance = ReturnType<typeof z.enum>;\n\nexport type PrimitiveZodType =\n | z.ZodString\n | z.ZodNumber\n | z.ZodBoolean\n | z.ZodDate\n | z.ZodEnum<any>\n | ZodenumInstance\n | ZodBrandedColorInstance\n | DecoratedPrimitiveZodType<z.ZodString>\n | DecoratedPrimitiveZodType<z.ZodNumber>\n | DecoratedPrimitiveZodType<z.ZodBoolean>\n | DecoratedPrimitiveZodType<z.ZodDate>\n | DecoratedPrimitiveZodType<z.ZodEnum<any>>\n | DecoratedPrimitiveZodType<ZodenumInstance>;\n\n\n //------------------------------------------------\n // SERIALIZATION\n //------------------------------------------------\n\n export type SerializableZodSchema =\n | { type: 'string'; optional?: boolean; nullable?: boolean; description?: string; metadata?: CustomFieldMetadata }\n | { type: 'number'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'bigint'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'boolean'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'date'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'unknown' | 'any'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'literal'; value: unknown; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'enum'; values: string[]; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'enum'; values: string[]; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'array'; element: SerializableZodSchema; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'set'; element: SerializableZodSchema; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'tuple'; items: SerializableZodSchema[]; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'record'; key: SerializableZodSchema; value: SerializableZodSchema; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'union'; options: SerializableZodSchema[]; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'object'; properties: Record<string, SerializableZodSchema>; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata }\n | { type: 'lazy'; optional?: boolean; nullable?: boolean; metadata?: CustomFieldMetadata };\n\n"]}
|