import { type Server } from '@hapi/hapi';
import { type AnyFormRequest, type CacheRequest, type FormConfirmationState, type FormPayload, type FormState, type FormSubmissionError, type FormSubmissionState } from '../../server/plugins/engine/types.js';
export declare enum ADDITIONAL_IDENTIFIER {
    Confirmation = ":confirmation"
}
export declare class CacheService {
    /**
     * This service is responsible for getting, storing or deleting a user's session data in the cache. This service has been registered by {@link createServer}
     */
    cache: import("@hapi/catbox").Policy<unknown, {
        cache: string | undefined;
        segment: string;
    }>;
    logger: Server['logger'];
    constructor({ server, cacheName }: {
        server: Server;
        cacheName?: string;
    });
    getState(request: CacheRequest): Promise<FormSubmissionState>;
    setState(request: CacheRequest, state: FormSubmissionState): Promise<FormSubmissionState>;
    getConfirmationState(request: CacheRequest): Promise<FormConfirmationState>;
    setConfirmationState(request: CacheRequest, confirmationState: FormConfirmationState): Promise<void>;
    clearState(request: CacheRequest): Promise<void>;
    getFlash(request: AnyFormRequest): {
        errors: FormSubmissionError[];
    } | undefined;
    setFlash(request: AnyFormRequest, message: {
        errors: FormSubmissionError[];
    }): void;
    /**
     * Resets (removes) component states from the form state by their keys.
     * Supports both flat keys and nested paths.
     * @param request - The Hapi request object
     * @param componentNames - Array of state keys to remove. Uses lodash's unset syntax. Can be:
     * - Flat keys: `'componentName'` for top-level state
     * - Nested paths: `"upload['/my-page']"` or `'upload./my-page'` for nested state
     * @example
     * ```typescript
     * // Remove a flat component state
     * await cacheService.resetComponentStates(request, ['emailAddress'])
     *
     * // Remove nested upload state for a specific page
     * await cacheService.resetComponentStates(request, ["upload['/file-upload-page']"])
     *
     * // Remove multiple states at once
     * await cacheService.resetComponentStates(request, [
     *   'componentName',
     *   "upload['/my-page']"
     * ])
     * ```
     * @returns The updated state after removal
     */
    resetComponentStates(request: CacheRequest, componentNames: string[]): Promise<FormSubmissionState>;
    /**
     * The key used to store user session data against.
     * If there are multiple forms on the same runner instance, for example `form-a` and `form-a-feedback` this will prevent CacheService from clearing data from `form-a` if a user gave feedback before they finished `form-a`
     * @param request - hapi request object
     * @param additionalIdentifier - appended to the id
     */
    Key(request: CacheRequest, additionalIdentifier?: ADDITIONAL_IDENTIFIER): {
        segment: string;
        id: string;
    };
}
/**
 * State merge helper
 * 1. Merges objects (form fields)
 * 2. Overwrites arrays
 */
export declare function merge<StateType extends FormState | FormPayload>(state: StateType, update: object): StateType;
