import { ShowToast, TaskStatus, PatternsErrorHandler } from '../../model';
import { Translate } from '../../services';
import { ModalState } from '../ModalState';
import { ConditionalModalState } from '../ConditionalModalState';
import { CreateExportAsyncJobRequest } from '@wix/bex-utils/@wix/ambassador-fedinfra-exportservice-v1-export-async-job/types';
export interface ImportCollection {
    clearResultAndMoveToStart(params?: {
        force?: boolean;
    }): void;
}
export interface BulkUploadError {
    rowIndex: number;
    message?: string;
    code?: string;
}
export interface BulkUploadResults {
    succeeded: number;
    failed: number;
    errors: BulkUploadError[];
    insertedIds?: string[];
}
export type BulkUploadItemsFn = (items: Record<string, unknown>[]) => Promise<BulkUploadResults>;
export interface BackupResult {
    restore(signal: AbortSignal): Promise<void>;
}
export type BackupFn = (signal: AbortSignal) => Promise<BackupResult | void>;
export type ImportField = NonNullable<CreateExportAsyncJobRequest['fields']>[number];
export interface ImportStateProps {
    fields: CreateExportAsyncJobRequest['fields'];
    bulkUploadItems: BulkUploadItemsFn;
    backup?: BackupFn;
    collection: ImportCollection;
    importModalState: ModalState;
    translate: Translate;
    errorHandler: PatternsErrorHandler;
    showToast?: ShowToast;
    batchSize?: number;
}
export type ImportStep = 'upload' | 'configuration' | 'progress';
export declare class ImportState {
    readonly fields: ImportField[];
    readonly bulkUploadItems: BulkUploadItemsFn;
    readonly backup?: BackupFn;
    readonly collection: ImportCollection;
    readonly importModalState: ModalState;
    readonly translate: Translate;
    readonly errorHandler: PatternsErrorHandler;
    readonly showToast?: ShowToast;
    readonly batchSize: number;
    readonly discardChangesModal: ConditionalModalState<"close" | "goBack">;
    currentStep: ImportStep;
    importStatus: TaskStatus<BulkUploadResults, unknown>;
    parseError: string | null;
    fileName: string;
    csvHeaders: string[];
    csvRows: string[][];
    mappingByHeader: Record<string, string | null>;
    processedCount: number;
    totalCount: number;
    result: BulkUploadResults;
    isBackingUp: boolean;
    isRestoring: boolean;
    private restoreFn;
    private _cancelled;
    private _abortController;
    constructor(props: ImportStateProps);
    init(): () => undefined;
    get hasParsedRows(): boolean;
    get hasMappings(): boolean;
    get selectedFieldIds(): Set<string>;
    get mappedRows(): Record<string, unknown>[];
    reset(): void;
    close(): Promise<void>;
    private _restoreBackup;
    goToUpload(): void;
    discardAndGoBack(): Promise<void>;
    discardAndClose(): Promise<void>;
    onUploadContinue(): void;
    private getDefaultMapping;
    private applyParsedCsv;
    onFileSelected(file: File | null): Promise<void>;
    setMapping(header: string, fieldId: string | null): void;
    private _uploadBatches;
    private _runBackup;
    private _createRowsBatches;
    startImport(): Promise<void>;
}
//# sourceMappingURL=ImportState.d.ts.map