import { EventEmitter, EventReturnType } from "./events";
import { RainwayPeerState } from "./rainway-ffi";
import { DataChannel } from "./data-channel";
import { OutboundStream } from "./outbound-stream";
import { RainwayConnection } from "./rainway-connection";
import { DataChannelOptions } from "./options";
import { CloseEvent, DataChannelEvent, PeerStateChangeEvent, StreamRequestEvent } from "./events/impls";
/**
 * Events emitted by {@link Peer}
 */
export interface PeerEvents {
    /**
     * Raised when the peer's connection state has changed.
     */
    "connection-state-change": (ev: PeerStateChangeEvent) => EventReturnType;
    /**
     * Raised when the remote peer announces a stream.
     */
    "stream-request": (ev: StreamRequestEvent) => EventReturnType;
    /**
     * Raised when the remote peer creates a data channel.
     */
    datachannel: (ev: DataChannelEvent) => EventReturnType;
    /**
     * Raised when the connection to Rainway has been closed.
     */
    close: (ev: CloseEvent) => EventReturnType;
}
/**
 * An object representing a connection to a remote Rainway peer.
 */
export declare class Peer extends EventEmitter<PeerEvents> {
    private _state;
    private _dataChannels;
    private _outboundStreams;
    private _onStateChanged;
    private _onStreamRequest;
    private _onDataChannel;
    /**
     * The connection from which this peer was created.
     */
    readonly connection: RainwayConnection;
    /**
     * This peer's Rainway id.
     */
    readonly id: BigInt;
    /**
     * A string identifying this peer in your organization.
     * For example: the "username" of the peer.
     */
    readonly externalId: string;
    /**
     * A map from channel ids (labels) to Data Channels opened between us and this peer.
     */
    get dataChannels(): ReadonlyMap<string, DataChannel>;
    /**
     * A map from Stream IDs to active streams associated with this peer.
     */
    get outboundStreams(): ReadonlyMap<number, OutboundStream>;
    /**
     * The peer's network connectivity state.
     */
    get state(): RainwayPeerState;
    /** @internal */
    constructor(connection: RainwayConnection, id: BigInt, externalId?: string);
    /**
     * Creates a data channel.
     * @param options - data channel options
     * @returns data channel object
     */
    createDataChannel(options: DataChannelOptions): Promise<DataChannel>;
    /**
     * Destroys the peer connection, including all sub resources.
     */
    close(): void;
}
