/// <reference types="react" />
import { FormPageState, ReportBI, WixPatternsContainer } from '@wix/bex-core';
import { FieldValues, UseFormReturn } from 'react-hook-form';
import { SettingsPageStateBIReporter } from './SettingsPageStateBIReporter';
import { TypedEmitter } from '@wix/bex-core/events';
export interface SettingsPageStateParams<T, V extends FieldValues = FieldValues> {
    /**
     * A function that fetches the settings data.
     * @returns a promise that resolves to an object containing the settings.
     */
    fetch: () => Promise<{
        settings: T | undefined;
    }>;
    /**
     * A function to handle the save action.
     */
    onSave: () => Promise<void>;
    /**
     * A function to handle the cancel action.
     */
    onCancel: () => Promise<void>;
    /**
     * An optional object with an optional message, or it can directly get a string message.
     */
    saveSuccessToast?: {
        message?: string;
    } | string;
    /**
     * An optional function to display an error toast message when a save operation fails.
     * @returns An object with a `message` and an `action` object. Alternatively, it can return an object with an optional `message` and a `tryAgain` flag, or a string message.
     * The previous return types are still supported but are now deprecated.
     */
    saveErrorToast?: (err: unknown, params: {
        retry: () => void;
    }) => {
        message?: string;
        /**
         * @deprecated use `action` instead
         */
        tryAgain?: boolean;
        action?: {
            text: string;
            onClick: () => void;
        };
    } | string;
    form: UseFormReturn<V>;
    /**
     * An object representing the container, possibly for dependency injection or component management.
     */
    container: WixPatternsContainer;
}
export interface SettingsPageStateInterface {
}
export declare class SettingsPageState<T, V extends FieldValues = FieldValues> implements SettingsPageStateInterface {
    readonly fetch: SettingsPageStateParams<T>['fetch'];
    readonly _onSave: SettingsPageStateParams<T, V>['onSave'];
    readonly _onCancel: SettingsPageStateParams<T, V>['onCancel'];
    readonly saveSuccessToast?: SettingsPageStateParams<T>['saveSuccessToast'];
    readonly saveErrorToast?: SettingsPageStateParams<T>['saveErrorToast'];
    _settings: T | null;
    readonly container: WixPatternsContainer;
    readonly reportBI: ReportBI;
    readonly bi: SettingsPageStateBIReporter<T, V>;
    readonly formPage: FormPageState<V>;
    readonly events: TypedEmitter<{
        save: () => void;
        saveError: (err: unknown) => void;
    }>;
    constructor(params: SettingsPageStateParams<T, V>);
    init(): () => void;
    retryFetch(): void;
    setSettings(newSettings: T | null): void;
    get settings(): T | null;
    get isFetching(): boolean;
    get form(): UseFormReturn<V, any, V>;
    get isDirty(): boolean;
    onCancel(): void;
    _showErrorToast(err: any, e?: React.BaseSyntheticEvent): void;
    _showSuccessToast(): void;
    handleSubmit(e?: React.BaseSyntheticEvent): Promise<void>;
    get initTask(): import("@wix/bex-core").TaskState<unknown>;
    get submitTask(): import("@wix/bex-core").TaskState<unknown>;
}
//# sourceMappingURL=SettingsPageState.d.ts.map