import type { ConnectionOptions, KeyObject, TlsOptions } from 'node:tls';
import type { IMessageStore } from 'fixparser-common';
import type { ProxyAgent } from 'proxy-agent';
import { Enums as EnumsCache } from './enums/Enums.ts';
import { Fields as FieldsCache } from './fields/Fields.ts';
import type { LogOptions } from './logger/Logger.ts';
import { Message } from './message/Message.ts';
/**
 * Connection transport type.
 * @public
 */
export type Protocol = 'tcp' | 'ssl-tcp' | 'tls-tcp' | 'websocket';
/**
 * Type of connection (client or server).
 * @public
 */
export type ConnectionType = 'acceptor' | 'initiator';
/**
 * Represents the configuration options for initializing the instance.
 *
 * @typedef {Object} BaseOptions
 * @property {boolean} [skipValidation=false] - Whether to skip validation of FIX messages. Defaults to `false`.
 * @property {string} [fixVersion="FIXT.1.1"] - The FIX protocol version to use. Defaults to `"FIXT.1.1"`, which is typically used by the BeginString tag (tag 8).
 * @property {boolean} [logging=true] - Whether to enable or disable logging. Defaults to `true`.
 * @property {LogOptions} [logOptions] - Options for customizing logging behavior. If not provided, no specific log configuration is applied.
 */
export type BaseOptions = {
    skipValidation?: boolean;
    fixVersion?: string;
    logging?: boolean;
    logOptions?: LogOptions;
};
/**
 * FIXParser initialization options.
 * @public
 */
export type Options = {
    host?: string;
    port?: number;
    protocol?: Protocol;
    sender?: string;
    target?: string;
    heartbeatIntervalSeconds?: number;
    fixVersion?: string;
    messageStoreIn?: IMessageStore<Message>;
    messageStoreOut?: IMessageStore<Message>;
    tlsSkipStdInPipe?: boolean;
    tlsOptions?: ConnectionOptions | TlsOptions;
    tlsTimeout?: number;
    tlsEncoding?: BufferEncoding;
    proxy?: ProxyAgent;
    skipValidation?: boolean;
    onReady?: () => void;
    onMessage?: (message: Message) => void;
    onOpen?: () => void;
    onClose?: () => void;
    onError?: (error?: Error) => void;
};
/**
 * Base class responsible for parsing and processing FIX messages.
 *
 * This class handles parsing of FIX messages, processing message fields and tags,
 * and performing validation on specific fields such as the body length, checksum,
 * and protocol version. It provides methods to process raw message data, extract
 * tag-value pairs, and validate the structure and content of FIX messages.
 */
export declare class FIXParserBase {
    fixVersion: string;
    message: Message | undefined;
    messageTags: string[];
    messageString: string;
    fields: FieldsCache;
    enums: EnumsCache;
    proxy?: ProxyAgent;
    tlsKey?: string | Buffer | Array<string | Buffer | KeyObject>;
    tlsCert?: string | Buffer | Array<string | Buffer>;
    tlsUseSNI?: boolean;
    tlsSkipStdInPipe?: boolean;
    skipValidation?: boolean;
    /**
     * Processes the message string by searching for a specific pattern and replacing occurrences
     * of a delimiter with a special character (SOH). It then sets the processed string into the
     * message object and splits the string into tags for further processing.
     *
     * - Uses a regular expression to find specific patterns in the message string.
     * - Replaces occurrences of the matched pattern with a delimiter (SOH).
     * - Sets the processed message string into the `message` object and splits it into `messageTags`.
     * - If the message format is invalid, the method resets the `message` and clears the `messageTags`.
     *
     * @returns {void}
     */
    processMessage(): void;
    /**
     * Processes the fields of the message by iterating over the tags and values, extracting
     * the tag-value pairs, and performing validation or other processing for specific fields.
     *
     * - Each tag-value pair is extracted from `messageTags` and converted into a `Field` object.
     * - The field is processed by both `fields.processField()` and `enums.processEnum()` methods.
     * - Special handling is applied to certain fields such as `BeginString`, `BodyLength`, and `CheckSum`.
     * - Validates the body length and checksum for the message, and updates the `fixVersion` based on the `BeginString` field.
     * - Adds each processed field to the `message` object for further processing or storage.
     *
     * @returns {void}
     */
    processFields(): void;
    /**
     * Parses a string of data into an array of `Message` objects by splitting the input data
     * into individual FIX messages and processing each message's fields and tags.
     *
     * The data is split using a regular expression to identify FIX message boundaries, specifically
     * looking for the `8=FIX` marker. Each resulting message string is processed, and its fields
     * are extracted and validated.
     *
     * - If the message string contains the `SOH` character, it is directly processed and split into tags.
     * - If `SOH` is absent, the message is processed using the `processMessage()` method.
     * - After processing, each `Message` object is populated with fields and added to the result array.
     *
     * @param {string} data - The raw data string containing one or more FIX messages.
     * @returns {Message[]} An array of `Message` objects parsed from the input string.
     */
    parse(data: string): Message[];
}
