import { type ComponentDef } from '@defra/forms-model';
import { type CustomValidator, type ErrorReportCollection, type ObjectSchema } from 'joi';
import { type Component, type Field, type Guidance } from '../../../../server/plugins/engine/components/helpers/components.js';
import { type ComponentViewModel } from '../../../../server/plugins/engine/components/types.js';
import { type FormModel } from '../../../../server/plugins/engine/models/index.js';
import { type PageControllerClass } from '../../../../server/plugins/engine/pageControllers/helpers/pages.js';
import { type FormPayload, type FormSubmissionError, type FormSubmissionState, type FormValidationResult } from '../../../../server/plugins/engine/types.js';
import { type FormQuery } from '../../../../server/routes/types.js';
export declare class ComponentCollection {
    page?: PageControllerClass;
    parent?: Component;
    components: Component[];
    fields: Field[];
    guidance: Guidance[];
    formSchema: ObjectSchema<FormPayload>;
    stateSchema: ObjectSchema<FormSubmissionState>;
    constructor(defs: ComponentDef[], props: {
        page?: PageControllerClass;
        parent?: Component;
        model: FormModel;
    }, schema?: {
        /**
         * Defines an all-or-nothing relationship between keys where if one
         * of the peers is present, all of them are required as well
         */
        peers?: string[];
        /**
         * Defines a custom validation rule for the object schema
         */
        custom?: CustomValidator;
    });
    get keys(): string[];
    getFormDataFromState(state: FormSubmissionState): FormPayload;
    getFormValueFromState(state: FormSubmissionState): FormPayload;
    getStateFromValidForm(payload: FormPayload): Partial<Record<string, import("../../../../server/plugins/engine/types.js").FormStateValue>>;
    getContextValueFromState(state: FormSubmissionState): Partial<Record<string, import("../../../../server/plugins/engine/types.js").FormStateValue>>;
    /**
     * Get all errors for all fields in this collection
     */
    getErrors(errors?: FormSubmissionError[]): FormSubmissionError[] | undefined;
    /**
     * Get view errors for all fields in this collection.
     * For most fields this means filtering to the first error in the list.
     * Composite fields like UKAddress can choose to return more than one error.
     */
    getViewErrors(errors?: FormSubmissionError[]): FormSubmissionError[] | undefined;
    getViewModel(payload: FormPayload, errors?: FormSubmissionError[], query?: FormQuery): ComponentViewModel[];
    /**
     * Validate form payload
     */
    validate(value?: FormPayload): FormValidationResult<FormPayload>;
    /**
     * Helper to get errors from all fields
     */
    private getFieldErrors;
}
/**
 * Check for field local state
 */
export declare function isErrorContext(value?: unknown): value is ErrorReportCollection['local'];
