import type { ObjectSchema } from "../bundled_nhtio_validation"; /** * Base interface for all Resourceful data type options. * Includes common modifier properties that apply to all data types. */ export interface BaseInterface { /** Whether the value can be null */ nullable?: boolean; /** Whether the property is read-only (not included in create/update operations) */ readOnly?: boolean; /** Whether the property is write-only (not included in response serialization) */ writeOnly?: boolean; } /** * Base type constraint for abstract constructor functions used in data type generation. */ export type BaseClass = abstract new (...args: any[]) => any; /** * A hybrid type that represents a constructor function which can be called both with and without the `new` keyword. * This type enables creating data type classes that work as both constructors and factory functions. * * @typeParam ClassConstructorOptions - The interface defining the constructor options for the class * @typeParam C - The abstract constructor type constraint */ export type CallableNewable = { readonly schema: ObjectSchema; new (...args: ConstructorParameters): InstanceType; } & { (...args: ConstructorParameters): InstanceType; } & { prototype: InstanceType; }; /** * Supported string formats for ResourcefulStringType, excluding OpenAPI reserved formats. * These formats provide additional validation and documentation for string fields. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export declare const ResourcefulStringFormat: ("password" | "byte")[]; /** * Union type of supported string formats for ResourcefulStringType. * Used to provide type safety when specifying string field formats. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export type ResourcefulStringFormat = (typeof ResourcefulStringFormat)[number]; /** * ResourcefulStringJoiFormat represents a collection of predefined validation formats for strings. * It is used to specify constraints or patterns that a string should adhere to during validation. * This type is typically employed in conjunction with validation libraries like Joi. */ export type ResourcefulStringJoiFormat = 'alphanum' | 'email' | 'uppercase' | 'lowercase' | 'creditCard' | 'dataUri' | 'domain' | 'uuid' | 'guid' | 'hex' | 'hostname' | 'ip' | 'duration' | 'uri' | 'fqdn'; export type ResourcefulEnumObject = { value: T; title?: string; i18n?: boolean; }; export type ResourcefulEnum = T[] | ResourcefulEnumObject[]; /** * Configuration options for ResourcefulStringType instances. * Defines validation rules and constraints for string-based fields in OpenAPI schemas. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export interface ResourcefulStringTypeOptions extends BaseInterface { /** Minimum length constraint for the string value */ minLength: number; /** Maximum length constraint for the string value */ maxLength: number; /** Regular expression pattern that the string value must match */ pattern?: string; /** String format specification, excluding OpenAPI reserved formats like date, date-time, and binary */ format?: ResourcefulStringFormat | Exclude | ResourcefulStringJoiFormat; /** Array of allowed string values for enumeration validation */ enum?: ResourcefulEnum; } /** * Callable constructor for creating validated string type instances. * Supports both constructor and function call patterns for flexible usage. * * @example * ```typescript * const stringType = new ResourcefulStringType({ minLength: 1, maxLength: 100 }) * const stringType2 = ResourcefulStringType({ pattern: '^[a-zA-Z]+$' }) * ``` * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export declare const ResourcefulStringType: CallableNewable; /** * Instance type for ResourcefulStringType with validated properties. * Represents a string data type with validation constraints as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export interface ResourcefulStringType extends ResourcefulStringTypeOptions { type: 'string'; } /** * Configuration options for ResourcefulDateType instances. * Represents date-only values formatted as ISO 8601 date strings. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export interface ResourcefulDateTypeOptions extends BaseInterface { autoCreate?: boolean; autoUpdate?: boolean; } /** * Callable constructor for creating validated date type instances. * Automatically sets the OpenAPI format to 'date' for ISO 8601 date strings. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export declare const ResourcefulDateType: CallableNewable; /** * Instance type for ResourcefulDateType with validated properties. * Represents a date-only value formatted as ISO 8601 date string as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export interface ResourcefulDateType extends ResourcefulDateTypeOptions { type: 'string'; format: 'date'; } /** * Configuration options for ResourcefulDateTimeType instances. * Represents date-time values formatted as ISO 8601 date-time strings. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export interface ResourcefulDateTimeTypeOptions extends BaseInterface { autoCreate?: boolean; autoUpdate?: boolean; } /** * Callable constructor for creating validated date-time type instances. * Automatically sets the OpenAPI format to 'date-time' for ISO 8601 date-time strings. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export declare const ResourcefulDateTimeType: CallableNewable; /** * Instance type for ResourcefulDateTimeType with validated properties. * Represents a date-time value formatted as ISO 8601 date-time string as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export interface ResourcefulDateTimeType extends ResourcefulDateTimeTypeOptions { type: 'string'; format: 'date-time'; } /** * Configuration options for ResourcefulBinaryType instances. * Defines constraints for binary data represented as base64-encoded strings. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export interface ResourcefulBinaryTypeOptions extends BaseInterface { /** Minimum length constraint for the base64-encoded binary data */ minLength: number; /** Maximum length constraint for the base64-encoded binary data */ maxLength: number; } /** * Callable constructor for creating validated binary type instances. * Automatically sets the OpenAPI format to 'binary' for base64-encoded binary data. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export declare const ResourcefulBinaryType: CallableNewable; /** * Instance type for ResourcefulBinaryType with validated properties. * Represents binary data as base64-encoded string as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#string | OpenAPI 3.0 String Type} */ export interface ResourcefulBinaryType extends ResourcefulBinaryTypeOptions { type: 'string'; format: 'binary'; } /** * Supported number formats for ResourcefulNumberType, following OpenAPI 3.0 specification. * These formats provide additional precision and validation for numeric fields. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type} */ export declare const ResourcefulNumberFormat: ("float" | "double")[]; /** * Union type of supported number formats for ResourcefulNumberType. * Used to provide type safety when specifying numeric field formats. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type} */ export type ResourcefulNumberFormat = (typeof ResourcefulNumberFormat)[number]; /** * Configuration options for ResourcefulNumberType instances. * Defines validation rules and constraints for numeric fields in OpenAPI schemas. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type} */ export interface ResourcefulNumberTypeOptions extends BaseInterface { /** Minimum value constraint for the number */ minimum: number; /** Whether the minimum value is exclusive (value must be greater than minimum) */ exclusiveMinimum: boolean; /** Maximum value constraint for the number */ maximum: number; /** Whether the maximum value is exclusive (value must be less than maximum) */ exclusiveMaximum: boolean; /** Number format specification for precision (float or double) */ format: ResourcefulNumberFormat; /** Value must be a multiple of this number */ multipleOf: number; } /** * Callable constructor for creating validated number type instances. * Supports floating-point numbers with configurable precision and range constraints. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type} */ export declare const ResourcefulNumberType: CallableNewable; /** * Instance type for ResourcefulNumberType with validated properties. * Represents floating-point numbers as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Number Type} */ export interface ResourcefulNumberType extends ResourcefulNumberTypeOptions { type: 'number'; } /** * Configuration options for ResourcefulIntegerType instances. * Defines validation rules and constraints for 32-bit integer fields in OpenAPI schemas. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type} */ export interface ResourcefulIntegerTypeOptions extends BaseInterface { /** Minimum value constraint for the integer */ minimum: number; /** Whether the minimum value is exclusive (value must be greater than minimum) */ exclusiveMinimum: boolean; /** Maximum value constraint for the integer */ maximum: number; /** Whether the maximum value is exclusive (value must be less than maximum) */ exclusiveMaximum: boolean; /** Value must be a multiple of this number */ multipleOf: number; } /** * Callable constructor for creating validated integer type instances. * Automatically sets the OpenAPI format to 'int32' for 32-bit signed integers. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type} */ export declare const ResourcefulIntegerType: CallableNewable; /** * Instance type for ResourcefulIntegerType with validated properties. * Represents 32-bit signed integers as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type} */ export interface ResourcefulIntegerType extends ResourcefulIntegerTypeOptions { type: 'integer'; format: 'int32'; } /** * Configuration options for ResourcefulBigintType instances. * Defines validation rules and constraints for 64-bit integer fields in OpenAPI schemas. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type} */ export interface ResourcefulBigintTypeOptions extends BaseInterface { /** Minimum value constraint for the 64-bit integer */ minimum: bigint; /** Whether the minimum value is exclusive (value must be greater than minimum) */ exclusiveMinimum: boolean; /** Maximum value constraint for the 64-bit integer */ maximum: bigint; /** Whether the maximum value is exclusive (value must be less than maximum) */ exclusiveMaximum: boolean; /** Value must be a multiple of this number */ multipleOf: bigint; } /** * Callable constructor for creating validated bigint type instances. * Automatically sets the OpenAPI format to 'int64' for 64-bit signed integers. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type} */ export declare const ResourcefulBigintType: CallableNewable; /** * Instance type for ResourcefulBigintType with validated properties. * Represents 64-bit signed integers as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type} */ export interface ResourcefulBigintType extends ResourcefulBigintTypeOptions { type: 'integer'; format: 'int64'; } /** * Configuration options for ResourcefulUnsignedIntegerType instances. * Defines validation rules and constraints for unsigned integer fields in OpenAPI schemas. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type} */ export interface ResourcefulUnsignedIntegerTypeOptions extends BaseInterface { /** Minimum value constraint for the unsigned integer */ minimum: number; /** Whether the minimum value is exclusive (value must be greater than minimum) */ exclusiveMinimum: boolean; /** Maximum value constraint for the unsigned integer */ maximum: number; /** Whether the maximum value is exclusive (value must be less than maximum) */ exclusiveMaximum: boolean; /** Value must be a multiple of this number */ multipleOf: number; } /** * Callable constructor for creating validated unsigned integer type instances. * Represents unsigned integers without a specific OpenAPI format constraint. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type} */ export declare const ResourcefulUnsignedIntegerType: CallableNewable; /** * Instance type for ResourcefulUnsignedIntegerType with validated properties. * Represents unsigned integers as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers | OpenAPI 3.0 Integer Type} */ export interface ResourcefulUnsignedIntegerType extends ResourcefulUnsignedIntegerTypeOptions { type: 'integer'; format: never; } /** * Configuration options for ResourcefulBooleanType instances. * Currently has no specific configuration options as boolean types are straightforward. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#boolean | OpenAPI 3.0 Boolean Type} */ export interface ResourcefulBooleanTypeOptions extends BaseInterface { } /** * Callable constructor for creating validated boolean type instances. * Represents simple true/false values in OpenAPI schemas. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#boolean | OpenAPI 3.0 Boolean Type} */ export declare const ResourcefulBooleanType: CallableNewable; /** * Instance type for ResourcefulBooleanType with validated properties. * Represents boolean true/false values as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#boolean | OpenAPI 3.0 Boolean Type} */ export interface ResourcefulBooleanType extends ResourcefulBooleanTypeOptions { type: 'boolean'; } /** * Configuration options for ResourcefulObjectType instances. * Defines complex object schemas with typed properties and validation rules. * Supports advanced OpenAPI features like oneOf, allOf, anyOf, and not operators. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#object | OpenAPI 3.0 Object Type} */ export interface ResourcefulObjectTypeOptions extends BaseInterface { /** Object properties definition supporting direct data types and composition patterns */ properties: { [key: string]: ResourcefulDataType | { oneOf: Array; } | { allOf: Array; } | { anyOf: Array; } | { not: Array; }; }; /** Array of property names that are required for object validation */ required?: string[]; /** Whether additional properties beyond those defined are allowed, or direct data type for additional properties */ additionalProperties?: boolean | ResourcefulDataType; /** Minimum number of properties required in the object */ minProperties?: number; /** Maximum number of properties allowed in the object */ maxProperties?: number; } /** * Callable constructor for creating validated object type instances. * Supports complex nested object schemas with property validation and constraints. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#object | OpenAPI 3.0 Object Type} */ export declare const ResourcefulObjectType: CallableNewable; /** * Instance type for ResourcefulObjectType with validated properties. * Represents complex object schemas with typed properties as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#object | OpenAPI 3.0 Object Type} */ export interface ResourcefulObjectType extends ResourcefulObjectTypeOptions { type: 'object'; } /** * Configuration options for ResourcefulArrayType instances. * Defines array schemas with typed items and validation constraints. * Supports complex item types including nested objects and arrays. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#array | OpenAPI 3.0 Array Type} */ export interface ResourcefulArrayTypeOptions extends BaseInterface { /** Type specification for array items, supporting all resourceful data types and composition patterns */ items: ResourcefulDataType | { oneOf: Array; } | { allOf: Array; } | { anyOf: Array; } | { not: Array; }; /** Minimum number of items required in the array */ minItems?: number; /** Maximum number of items allowed in the array */ maxItems?: number; /** Whether all items in the array must be unique */ uniqueItems?: boolean; } /** * Callable constructor for creating validated array type instances. * Supports arrays with typed items and validation constraints like minimum/maximum length. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#array | OpenAPI 3.0 Array Type} */ export declare const ResourcefulArrayType: CallableNewable; /** * Instance type for ResourcefulArrayType with validated properties. * Represents arrays with typed items and validation constraints as defined in the OpenAPI 3.0 specification. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#array | OpenAPI 3.0 Array Type} */ export interface ResourcefulArrayType extends ResourcefulArrayTypeOptions { type: 'array'; } /** * Union type representing all available resourceful data types. * Provides a comprehensive type for working with any resourceful data type instance. * * @see {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/ | OpenAPI 3.0 Data Types} */ export type ResourcefulDataType = ResourcefulStringType | ResourcefulDateType | ResourcefulDateTimeType | ResourcefulBinaryType | ResourcefulNumberType | ResourcefulIntegerType | ResourcefulBigintType | ResourcefulUnsignedIntegerType | ResourcefulBooleanType | ResourcefulObjectType | ResourcefulArrayType;