import { type PageFileUpload } from '@defra/forms-model';
import { type ValidationErrorItem } from 'joi';
import { type FileUploadField } from '~/src/server/plugins/engine/components/FileUploadField.js';
import { type FormModel } from '~/src/server/plugins/engine/models/index.js';
import { QuestionPageController } from '~/src/server/plugins/engine/pageControllers/QuestionPageController.js';
import { type AnyFormRequest, type FeaturedFormPageViewModel, type FormContext, type FormContextRequest, type FormSubmissionError, type FormSubmissionState, type UploadInitiateResponse, type UploadStatusFileResponse } from '~/src/server/plugins/engine/types.js';
import { type FormRequest, type FormRequestPayload, type FormResponseToolkit } from '~/src/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);
    getFormDataFromState(request: FormContextRequest | undefined, state: FormSubmissionState): import("~/src/server/plugins/engine/types.js").FormPayload;
    getState(request: AnyFormRequest): Promise<FormSubmissionState>;
    /**
     * Get the uploaded files from state.
     */
    getFilesFromState(state: FormSubmissionState): import("~/src/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;
    /**
     * 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;
}
