import { type Server } from '@hapi/hapi';
import { type AnyFormRequest, type AnyRequest, type FormPayload, type FormState, type FormSubmissionError, type FormSubmissionState } from '~/src/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: AnyRequest): Promise<FormSubmissionState>;
    setState(request: AnyFormRequest, state: FormSubmissionState): Promise<FormSubmissionState>;
    getConfirmationState(request: AnyFormRequest): Promise<{
        confirmed?: true;
    }>;
    setConfirmationState(request: AnyFormRequest, confirmationState: {
        confirmed?: true;
    }): Promise<void>;
    clearState(request: AnyFormRequest): Promise<void>;
    getFlash(request: AnyFormRequest): {
        errors: FormSubmissionError[];
    } | undefined;
    setFlash(request: AnyFormRequest, message: {
        errors: FormSubmissionError[];
    }): void;
    /**
     * 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: AnyRequest, 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;
