/**
 * Matrix Channel Adapter
 *
 * Matrix integration via the matrix-js-sdk.
 * Supports text, media messaging, room events, and end-to-end encryption (if olm is available).
 *
 * Requires: npm install matrix-js-sdk (optional dependency, loaded dynamically)
 *
 * Reference: https://spec.matrix.org/latest/client-server-api/
 */
import type { ChannelConfig, OutboundMessage, DeliveryResult } from '../index.js';
import { BaseChannel } from '../index.js';
/**
 * Matrix-specific configuration
 */
export interface MatrixConfig extends ChannelConfig {
    type: 'matrix';
    /** Homeserver URL (e.g. https://matrix.org) */
    homeserverUrl: string;
    /** Full Matrix user ID (e.g. @bot:matrix.org) */
    userId: string;
    /** Access token for authentication */
    accessToken: string;
    /** Device ID (optional, for E2EE sessions) */
    deviceId?: string;
    /** Auto-join rooms on invite (default: true) */
    autoJoin?: boolean;
    /** Room IDs to join on startup */
    initialRooms?: string[];
    /** Store path for sync/crypto state */
    storePath?: string;
    /** Enable end-to-end encryption support (requires olm) */
    enableEncryption?: boolean;
}
/**
 * Matrix room info
 */
export interface MatrixRoom {
    roomId: string;
    name?: string;
    topic?: string;
    isDirect?: boolean;
    memberCount?: number;
    canonicalAlias?: string;
}
/**
 * Matrix event content
 */
export interface MatrixEventContent {
    msgtype?: string;
    body?: string;
    formatted_body?: string;
    format?: string;
    url?: string;
    info?: {
        mimetype?: string;
        size?: number;
        w?: number;
        h?: number;
        duration?: number;
        thumbnail_url?: string;
    };
    'm.relates_to'?: {
        'm.in_reply_to'?: {
            event_id: string;
        };
        rel_type?: string;
        event_id?: string;
        key?: string;
    };
    'm.new_content'?: MatrixEventContent;
    filename?: string;
}
/**
 * Matrix room event (simplified)
 */
export interface MatrixRoomEvent {
    event_id: string;
    type: string;
    room_id: string;
    sender: string;
    origin_server_ts: number;
    content: MatrixEventContent;
    unsigned?: {
        age?: number;
        transaction_id?: string;
    };
    state_key?: string;
}
/**
 * Matrix channel using matrix-js-sdk
 */
export declare class MatrixChannel extends BaseChannel {
    private client;
    private roomCache;
    private syncing;
    private reconnectionManager;
    constructor(config: MatrixConfig);
    private get matrixConfig();
    /**
     * Connect to Matrix using matrix-js-sdk
     */
    connect(): Promise<void>;
    /**
     * Disconnect from Matrix
     */
    disconnect(): Promise<void>;
    /**
     * Send a message to a Matrix room
     */
    send(message: OutboundMessage): Promise<DeliveryResult>;
    /**
     * Send a media attachment to a room
     */
    private sendMedia;
    /**
     * Register event handlers on the Matrix client
     */
    private registerEventHandlers;
    /**
     * Handle a room timeline event
     */
    private handleTimelineEvent;
    /**
     * Handle membership changes (auto-join on invite)
     */
    private handleMembershipChange;
    /**
     * Handle typing notifications
     */
    private handleTypingEvent;
    /**
     * Join a Matrix room by ID or alias
     */
    joinRoom(roomIdOrAlias: string): Promise<string>;
    /**
     * Leave a Matrix room
     */
    leaveRoom(roomId: string): Promise<void>;
    /**
     * Get joined rooms
     */
    getJoinedRooms(): Promise<string[]>;
    /**
     * Send a typing indicator
     */
    sendTyping(roomId: string, typing?: boolean, timeoutMs?: number): Promise<void>;
    /**
     * Send a read receipt for an event
     */
    sendReadReceipt(roomId: string, eventId: string): Promise<void>;
    /**
     * React to a message with an emoji
     */
    react(roomId: string, eventId: string, emoji: string): Promise<void>;
    /**
     * Redact (delete) a message
     */
    redactMessage(roomId: string, eventId: string, reason?: string): Promise<void>;
    /**
     * Get room info from the SDK room object or cache
     */
    private getRoomInfo;
    /**
     * Get display name for a user from the room member list
     */
    private getDisplayName;
    /**
     * Extract attachments from Matrix event content
     */
    private extractAttachments;
    /**
     * Convert Matrix msgtype to ContentType
     */
    private msgtypeToContentType;
    /**
     * Convert ContentType to Matrix msgtype
     */
    private contentTypeToMsgtype;
}
export default MatrixChannel;
