import { Validation } from '@tempots/std';
import { PathSegment } from './path';
/**
 * Represents a validation error for a form controller with support for nested field errors.
 */
export type ControllerError = {
    /** The error message for this field. */
    message?: string;
    /** Nested errors for child fields, keyed by field name or array index. */
    dependencies?: Record<PathSegment, ControllerError>;
};
/**
 * Validation state for a controller, which can be valid, pending, or invalid with a ControllerError.
 * This is an alias for `Validation<ControllerError>` from @tempots/std.
 */
export type ControllerValidation = Validation<ControllerError>;
/**
 * Helper object for creating ControllerValidation instances.
 *
 * @example
 * ```typescript
 * // Valid state
 * ControllerValidation.valid
 *
 * // Invalid with a message
 * ControllerValidation.invalid('Something went wrong')
 *
 * // Invalid with field-specific errors
 * ControllerValidation.invalidFields({
 *   email: 'Invalid email format',
 *   password: 'Password too short',
 * })
 *
 * // Invalid from a ControllerError object
 * ControllerValidation.fromError({
 *   message: 'Form has errors',
 *   dependencies: { field: { message: 'Error' } }
 * })
 * ```
 */
export declare const ControllerValidation: {
    /** A valid validation result */
    readonly valid: ControllerValidation;
    /**
     * Create an invalid validation with a message
     */
    readonly invalid: (message: string) => ControllerValidation;
    /**
     * Create an invalid validation with field-specific errors.
     * Values can be error messages (strings) or full ControllerError objects.
     */
    readonly invalidFields: (fields: Record<PathSegment, string | ControllerError>) => ControllerValidation;
    /**
     * Create an invalid validation from a ControllerError object
     */
    readonly fromError: (error: ControllerError) => ControllerValidation;
};
/**
 * Creates a function that extracts validation state for a specific subpath from a parent validation.
 * Used internally to propagate validation errors to child controllers.
 *
 * @param fields - Path segments to traverse to find the relevant error
 * @returns A function that maps parent validation state to child validation state
 *
 * @example
 * ```typescript
 * const mapEmail = makeMapValidation(['user', 'email'])
 * const parentStatus = Validation.invalid({
 *   dependencies: {
 *     user: {
 *       dependencies: {
 *         email: { message: 'Invalid email' }
 *       }
 *     }
 *   }
 * })
 * const emailStatus = mapEmail(parentStatus) // Validation.invalid({ message: 'Invalid email' })
 * ```
 */
export declare function makeMapValidation(fields: PathSegment[]): (status: ControllerValidation) => ControllerValidation;
