/**
 * Copyright 2024-2026, Optimizely
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { EventProcessor, ProcessableEvent } from "./event_processor";
import { Store } from "../utils/cache/store";
import { EventDispatcher, LogEvent } from "./event_dispatcher/event_dispatcher";
import { BackoffController, Repeater } from "../utils/repeater/repeater";
import { LoggerFacade } from '../logging/logger';
import { BaseService, StartupLog } from "../service";
import { Consumer, Fn, Producer } from "../utils/type";
import { Platform } from '../platform_support';
export declare const DEFAULT_MIN_BACKOFF = 200;
export declare const DEFAULT_MAX_BACKOFF = 1000;
export declare const MAX_EVENTS_IN_STORE = 500;
export type EventWithId = {
    id: string;
    event: ProcessableEvent;
};
export type RetryConfig = {
    maxRetries: number;
    backoffProvider: Producer<BackoffController>;
};
export type BatchEventProcessorConfig = {
    dispatchRepeater: Repeater;
    failedEventRepeater?: Repeater;
    batchSize: number;
    eventStore?: Store<EventWithId>;
    eventDispatcher: EventDispatcher;
    closingEventDispatcher?: EventDispatcher;
    logger?: LoggerFacade;
    retryConfig?: RetryConfig;
    startupLogs?: StartupLog[];
};
export declare const LOGGER_NAME = "BatchEventProcessor";
export declare class BatchEventProcessor extends BaseService implements EventProcessor {
    private eventDispatcher;
    private closingEventDispatcher?;
    private eventQueue;
    private batchSize;
    private eventStore?;
    private dispatchRepeater;
    private failedEventRepeater?;
    private idGenerator;
    private runningTask;
    private dispatchingEvents;
    private eventEmitter;
    private retryConfig?;
    constructor(config: BatchEventProcessorConfig);
    setLogger(logger: LoggerFacade): void;
    onDispatch(handler: Consumer<LogEvent>): Fn;
    retryFailedEvents(): Promise<void>;
    private createNewBatch;
    private executeDispatch;
    private dispatchBatch;
    private flush;
    process(event: ProcessableEvent): Promise<void>;
    start(): void;
    makeDisposable(): void;
    flushImmediately(): Promise<unknown>;
    stop(): void;
}
export declare const __platforms: Platform[];
