import { IncomingMessage, ServerResponse } from 'http';
import type { JoinParams, SignatureParams, WebhookCallback, RawWebhookCallback, VideoParams, AudioParams, DeskshareParams } from "./rtms.d.ts";
declare const nativeRtms: any;
/**
 * Available log levels for the RTMS SDK
 */
export declare enum LogLevel {
    /** Error messages only */
    ERROR = 0,
    /** Error and warning messages */
    WARN = 1,
    /** Error, warning, and informational messages (default) */
    INFO = 2,
    /** All messages including debug information */
    DEBUG = 3,
    /** All messages including detailed trace information */
    TRACE = 4
}
/**
 * Available log formats for the RTMS SDK
 */
export declare enum LogFormat {
    /** Human-readable progressive format for console output */
    PROGRESSIVE = "progressive",
    /** Machine-readable JSON format for log processing */
    JSON = "json"
}
/**
 * Configuration options for the logger
 */
export interface LoggerConfig {
    /** The minimum log level to display */
    level: LogLevel;
    /** The format for log output */
    format: LogFormat;
    /** Whether logging is enabled */
    enabled: boolean;
}
/**
 * Generates an HMAC-SHA256 signature for RTMS authentication
 *
 * This function creates a signature required for authenticating with Zoom RTMS servers.
 * It uses HMAC-SHA256 with the client secret as the key and a concatenated string of
 * client ID, meeting UUID, and stream ID as the message.
 *
 * @param params Parameters for signature generation
 * @returns Hex-encoded HMAC-SHA256 signature
 * @throws ReferenceError if client ID or secret is empty
 */
declare function generateSignature({ client, secret, uuid, streamId }: SignatureParams): string;
/**
 * Helper type to detect callback type
 */
type WebhookCallbackUnion = WebhookCallback | RawWebhookCallback;
/**
 * Creates a request handler for webhook events that can be mounted on existing HTTP servers
 *
 * This function returns a Node.js request handler compatible with Express, Fastify,
 * and other HTTP frameworks. It allows you to integrate Zoom webhook handling with
 * your existing application routes on a shared port.
 *
 * The handler validates that requests are POST requests to the specified path,
 * parses JSON payloads, and invokes your callback with the webhook data.
 *
 * @param callback Function to call when webhook events are received
 * @param path The URL path to listen on (e.g., '/zoom/webhook')
 * @returns A request handler function compatible with http.Server
 *
 * @example
 * ```typescript
 * import express from 'express';
 * import rtms from '@zoom/rtms';
 *
 * const app = express();
 *
 * // Your application routes
 * app.get('/health', (req, res) => res.json({ status: 'ok' }));
 *
 * // Mount Zoom webhook handler on the same server
 * const webhookHandler = rtms.createWebhookHandler(
 *   (payload) => {
 *     console.log(`Received: ${payload.event}`);
 *   },
 *   '/zoom/webhook'
 * );
 *
 * // Use the handler directly with Express
 * app.post('/zoom/webhook', webhookHandler);
 *
 * // Single port for all routes
 * app.listen(8080);
 * ```
 *
 * @category Common Functions
 */
export declare function createWebhookHandler(callback: WebhookCallbackUnion, path: string): (req: IncomingMessage, res: ServerResponse) => void;
/**
 * Sets up a webhook server to receive events from Zoom
 *
 * This function creates an HTTP or HTTPS server that listens for webhook events from Zoom.
 * When a webhook event is received, it parses the JSON payload and passes it to
 * the provided callback function.
 *
 * For secure HTTPS connections, provide the following environment variables:
 * - ZM_RTMS_CERT: Path to SSL certificate file
 * - ZM_RTMS_KEY: Path to SSL certificate key file
 * - ZM_RTMS_CA_WEBHOOK: (Optional) Path to CA certificate for client verification
 *
 * @param callback Function to call when webhook events are received
 *
 */
export declare function onWebhookEvent(callback: WebhookCallback | RawWebhookCallback): void;
/**
 * Client class for connecting to Zoom RTMS streams
 *
 * This class provides an object-oriented interface for connecting to and
 * processing Zoom RTMS streams. Use this approach when you need to connect
 * to multiple meetings simultaneously.
 *
 */
declare class Client extends nativeRtms.Client {
    private pollingInterval;
    private pollRate;
    private participantEventCallback;
    private activeSpeakerEventCallback;
    private sharingEventCallback;
    private rawEventCallback;
    private mediaConnectionInterruptedCallback;
    private eventHandlerRegistered;
    constructor();
    /**
     * Internal event dispatcher that routes events to typed callbacks
     * @private
     */
    private setupEventHandler;
    /**
     * Join a Zoom RTMS session
     *
     * This method establishes a connection to a Zoom RTMS stream.
     * It automatically handles initialization, signature generation,
     * and starts background polling for events.
     *
     * @param options Object containing join parameters
     * @returns true if the join operation succeeds
  
     */
    join(options: JoinParams): boolean;
    /**
     * Sets audio parameters for the client
     */
    setAudioParams(params: AudioParams): boolean;
    /**
     * Sets video parameters for the client
     */
    setVideoParams(params: VideoParams): boolean;
    /**
    * Sets deskshare parameters for the client
    */
    setDeskshareParams(params: DeskshareParams): boolean;
    /**
     * Register a callback for participant join/leave events
     *
     * This automatically subscribes to EVENT_PARTICIPANT_JOIN and EVENT_PARTICIPANT_LEAVE.
     * Events are delivered as parsed objects, not raw JSON.
     *
     * @param callback Function called when participants join or leave
     * @returns true if registration succeeds
     *
     * @example
     * ```typescript
     * client.onParticipantEvent((event, timestamp, participants) => {
     *   console.log(`Participant ${event}:`, participants);
     * });
     * ```
     */
    onParticipantEvent(callback: (event: 'join' | 'leave', timestamp: number, participants: Array<{
        userId: number;
        userName?: string;
    }>) => void): boolean;
    /**
     * Register a callback for active speaker change events
     *
     * This automatically subscribes to EVENT_ACTIVE_SPEAKER_CHANGE.
     *
     * @param callback Function called when the active speaker changes
     * @returns true if registration succeeds
     *
     * @example
     * ```typescript
     * client.onActiveSpeakerEvent((timestamp, userId, userName) => {
     *   console.log(`Active speaker: ${userName} (${userId})`);
     * });
     * ```
     */
    onActiveSpeakerEvent(callback: (timestamp: number, userId: number, userName: string) => void): boolean;
    /**
     * Register a callback for sharing start/stop events
     *
     * This automatically subscribes to EVENT_SHARING_START and EVENT_SHARING_STOP.
     * Note: These events only work when the RTMS app has DESKSHARE scope permission.
     *
     * @param callback Function called when sharing starts or stops
     * @returns true if registration succeeds
     *
     * @example
     * ```typescript
     * client.onSharingEvent((event, timestamp, userId, userName) => {
     *   console.log(`Sharing ${event} by ${userName}`);
     * });
     * ```
     */
    onSharingEvent(callback: (event: 'start' | 'stop', timestamp: number, userId?: number, userName?: string) => void): boolean;
    /**
     * Register a callback for media connection interrupted events
     *
     * This automatically subscribes to EVENT_MEDIA_CONNECTION_INTERRUPTED.
     *
     * @param callback Function called when the media connection is interrupted
     * @returns true if registration succeeds
     *
     * @example
     * ```typescript
     * client.onMediaConnectionInterrupted((timestamp) => {
     *   console.log(`Media connection interrupted at ${timestamp}`);
     * });
     * ```
     */
    onMediaConnectionInterrupted(callback: (timestamp: number) => void): boolean;
    /**
     * Register a callback for raw event data
     *
     * This provides access to the raw JSON event data from the SDK.
     * Use this when you need custom event handling or access to all event types.
     * This callback is called IN ADDITION to typed callbacks, not instead of.
     *
     * @param callback Function called with raw JSON event data
     * @returns true if registration succeeds
     *
     * @example
     * ```typescript
     * client.onEventEx((eventData) => {
     *   const data = JSON.parse(eventData);
     *   console.log('Raw event:', data);
     * });
     * ```
     */
    onEventEx(callback: (eventData: string) => void): boolean;
    /**
     * Start background polling for events
     *
     * @private
     */
    private startPolling;
    /**
     * Stop background polling
     *
     * @private
     */
    private stopPolling;
    /**
     * Leave the current RTMS session and clean up resources
     *
     * This method disconnects from the Zoom RTMS stream, stops
     * background polling, and releases resources.
     *
     * @returns true if the leave operation succeeds
     */
    leave(): boolean;
}
/**
 * Configure the RTMS logger
 *
 * This function allows you to configure the logging behavior of the RTMS SDK.
 * You can change the log level, format, and enable/disable logging.
 *
 * @param options Configuration options for the logger
 */
declare function configureLogger(options: Partial<LoggerConfig>): void;
/**
 * Default export object for the RTMS module
 */
declare const _default: {
    Client: typeof Client;
    onWebhookEvent: typeof onWebhookEvent;
    createWebhookHandler: typeof createWebhookHandler;
    generateSignature: typeof generateSignature;
    isInitialized: () => boolean;
    configureLogger: typeof configureLogger;
    LogLevel: typeof LogLevel;
    LogFormat: typeof LogFormat;
};
export default _default;
