import { TransportEncoder } from '@boringnode/bus/types/main';
import { CacheBusMessageType } from '../../types/bus.js';
import '../../types/helpers.js';
import 'typescript-log';

/**
 * A Binary Encoder that encodes and decodes CacheBusMessage
 *
 * The encoding is as follows:
 * - The bus ID is encoded as a UTF8 string and directly appended to the resulting buffer.
 *   Note that the length of the bus ID should be specified in the constructor.
 *
 * - The message type is encoded as a single byte, with 0x01 for 'Set' message, and 0x02 for a 'Delete' message
 *
 * - The keys are encoded as follows:
 *   - A 4-byte big-endian integer representing the length of the key in bytes
 *   - The key itself
 *
 * - These components are concatenated together in the order busId -> type -> keys
 *
 */
declare class BinaryEncoder implements TransportEncoder {
    #private;
    /**
     * We assume the bus ID is a string of length 24 by default.
     * Because this is the default length of a cuid
     */
    constructor(busIdLength?: number);
    protected busMessageTypeToNum(type: CacheBusMessageType): number;
    protected numToBusMessageType(num: number): CacheBusMessageType;
    /**
     * Encode the given message into a Buffer
     */
    encode(message: any): string | Buffer;
    /**
     * Decode the given Buffer into a CacheBusMessage
     */
    decode(data: string | Buffer): any;
}

export { BinaryEncoder };
