/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Observable } from "@matter/general";
import { BdxMessenger } from "../BdxMessenger.js";
import { PersistedFileDesignator } from "../PersistedFileDesignator.js";
/** Base class for BDX transfer flows. */
export declare abstract class Flow {
    #private;
    readonly progressInfo: Observable<[bytesTransferred: number, totalBytesLength: number | undefined], void>;
    readonly progressFinished: Observable<[totalBytesTransferred: number], void>;
    readonly progressCancelled: Observable<any[], void>;
    constructor(messenger: BdxMessenger, transferParameters: Flow.TransferOptions);
    protected set dataLength(value: number);
    get dataLength(): number | undefined;
    protected set transferredBytes(value: number);
    get transferredBytes(): number;
    protected get transferParameters(): Flow.TransferOptions;
    protected get isClosed(): boolean;
    protected get messenger(): BdxMessenger;
    protected get bytesLeft(): number | undefined;
    protected set bytesLeft(value: number);
    protected set finalBlockCounter(blockCounter: number);
    protected get finalBlockCounter(): number;
    /** Determines the next message counter to use for the next message, also handles wrapping around at 2^32. */
    protected get nextMessageCounter(): number;
    /** Utility function to check if a block counter is valid */
    protected validateCounter(messageBlockCounter: number, expectedCounter?: number): number;
    close(_error?: unknown): Promise<void>;
    /**
     * Main logic method to execute the flow.
     * The promise resolves when the flow is complete, or rejects on any error or unexpected conditions.
     */
    processTransfer(): Promise<void>;
    protected abstract initTransfer(): Promise<void>;
    protected abstract transferNextChunk(): Promise<boolean>;
    protected abstract finalizeTransfer(): Promise<void>;
}
export declare namespace Flow {
    interface TransferOptions {
        transferMode: DriverMode;
        asynchronousTransfer: false;
        dataLength?: number;
        startOffset: number;
        blockSize: number;
        isDriver: boolean;
        fileDesignator: PersistedFileDesignator;
    }
    enum DriverMode {
        SenderDrive = "senderDrive",
        ReceiverDrive = "receiverDrive"
    }
}
//# sourceMappingURL=Flow.d.ts.map