import { type PageFileUpload } from '@defra/forms-model';
import { type ValidationErrorItem } from 'joi';
import { FileUploadField } from '../../../../server/plugins/engine/components/FileUploadField.js';
import { type FormComponent } from '../../../../server/plugins/engine/components/FormComponent.js';
import { type FormModel } from '../../../../server/plugins/engine/models/index.js';
import { QuestionPageController } from '../../../../server/plugins/engine/pageControllers/QuestionPageController.js';
import { type AnyFormRequest, type FeaturedFormPageViewModel, type FormContext, type FormContextRequest, type FormSubmissionError, type FormSubmissionState, type UploadInitiateResponse, type UploadStatusFileResponse } from '../../../../server/plugins/engine/types.js';
import { type FormRequest, type FormRequestPayload, type FormResponseToolkit } from '../../../../server/routes/types.js';
export declare function prepareStatus(status: UploadStatusFileResponse): UploadStatusFileResponse;
export declare class FileUploadPageController extends QuestionPageController {
    pageDef: PageFileUpload;
    fileUpload: FileUploadField;
    fileDeleteViewName: string;
    constructor(model: FormModel, pageDef: PageFileUpload);
    /**
     * Get supplementary state keys for clearing file upload state.
     * Returns the nested upload path for FileUploadField components only.
     * @param component - The component to get supplementary state keys for
     * @returns Array containing the nested upload path, e.g., ["upload['/page-path']"]
     * or ['upload'] if no page path is available. Returns empty array for non-FileUploadField components.
     */
    getStateKeys(component: FormComponent): string[];
    getFormDataFromState(request: FormContextRequest | undefined, state: FormSubmissionState): import("../../../../server/plugins/engine/types.js").FormPayload;
    getState(request: AnyFormRequest): Promise<FormSubmissionState>;
    /**
     * Get the uploaded files from state.
     */
    getFilesFromState(state: FormSubmissionState): import("../../../../server/plugins/engine/types.js").UploadState;
    /**
     * Get the initiated upload from state.
     */
    getUploadFromState(state: FormSubmissionState): UploadInitiateResponse | undefined;
    makeGetItemDeleteRouteHandler(): (request: FormRequest, context: FormContext, h: FormResponseToolkit) => import("@hapi/hapi").ResponseObject;
    makePostItemDeleteRouteHandler(): (request: FormRequestPayload, context: FormContext, h: FormResponseToolkit) => Promise<import("@hapi/hapi").ResponseObject>;
    getErrors(details?: ValidationErrorItem[]): FormSubmissionError[] | undefined;
    getViewModel(request: FormContextRequest, context: FormContext): FeaturedFormPageViewModel;
    /**
     * Refreshes the CDP upload and files in the
     * state and checks for any removed files.
     *
     * If an upload exists and hasn't been consumed
     * it gets re-used, otherwise we initiate a new one.
     * @param request - the hapi request
     * @param state - the form state
     */
    private refreshUpload;
    /**
     * If an upload exists and hasn't been consumed
     * it gets re-used, otherwise a new one is initiated.
     * @param request - the hapi request
     * @param state - the form state
     * @param depth - the number of retries so far
     */
    private checkUploadStatus;
    /**
     * Processes the uploaded files from a CDP status response.
     * Complete files are added to state, rejected/pending files
     * have their error messages flashed.
     * @param request - the hapi request
     * @param state - the form state
     * @param validatedItem - the Joi-validated upload item
     * @param files - the current files array from state
     * @param upload - the current upload initiation response
     */
    private processUploadedFiles;
    /**
     * Checks the payload for a file getting removed
     * and removes it from the upload files if found
     * @param request - the hapi request
     * @param state - the form state
     * @returns updated state if any files have been removed
     */
    private checkRemovedFiles;
    /**
     * Initiates a CDP file upload and stores in the upload state
     * @param request - the hapi request
     * @param state - the form state
     */
    private initiateAndStoreNewUpload;
}
