/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { DiscoveryData, ScannerSet } from "#common/Scanner.js";
import { AsyncObservable, BasicSet, ConnectionlessTransportSet, Construction, Duration, Environment, Environmental, ImmutableSet, Lifetime, MatterError, ObservableSet, Semaphore, ServerAddressUdp } from "#general";
import { PeerAddress } from "#peer/PeerAddress.js";
import { ExchangeManager } from "#protocol/ExchangeManager.js";
import { DedicatedChannelExchangeProvider, ReconnectableExchangeProvider } from "#protocol/ExchangeProvider.js";
import { SecureSession } from "#session/SecureSession.js";
import { SessionManager } from "#session/SessionManager.js";
import { CaseAuthenticatedTag } from "#types";
import { Peer } from "./Peer.js";
import { PeerAddressStore } from "./PeerAddressStore.js";
import { PeerDescriptor } from "./PeerDescriptor.js";
/**
 * Types of discovery that may be performed when connecting operationally.
 */
export declare enum NodeDiscoveryType {
    /** No discovery is done, in calls means that only known addresses are tried. */
    None = 0,
    /** Retransmission discovery means that we ignore known addresses and start a query for 5s. */
    RetransmissionDiscovery = 1,
    /** Timed discovery means that the device is discovered for a defined timeframe, including known addresses. */
    TimedDiscovery = 2,
    /** Full discovery means that the device is discovered until it is found, excluding known addresses. */
    FullDiscovery = 3
}
/** Error when an unknown node is tried to be connected or any other action done with it. */
export declare class UnknownNodeError extends MatterError {
}
/**
 * Configuration for discovering when establishing a peer connection.
 */
export interface DiscoveryOptions {
    discoveryType?: NodeDiscoveryType;
    timeout?: Duration;
    discoveryData?: DiscoveryData;
}
/**
 * Extended discovery options that include case authenticated tags for peer connections.
 */
export interface PeerConnectionOptions {
    discoveryOptions?: DiscoveryOptions;
    caseAuthenticatedTags?: CaseAuthenticatedTag[];
    queue?: Semaphore;
}
/**
 * Interfaces {@link PeerSet} with other components.
 */
export interface PeerSetContext {
    lifetime: Lifetime.Owner;
    sessions: SessionManager;
    exchanges: ExchangeManager;
    scanners: ScannerSet;
    transports: ConnectionlessTransportSet;
    store: PeerAddressStore;
}
/**
 * Manages operational connections to peers on shared fabric.
 */
export declare class PeerSet implements ImmutableSet<Peer>, ObservableSet<Peer> {
    #private;
    constructor(context: PeerSetContext);
    get added(): import("#general").Observable<[Peer], void>;
    get deleted(): import("#general").Observable<[Peer], void>;
    get empty(): import("#general").ObservableValue<[boolean], void>;
    get disconnected(): AsyncObservable<[peer: Peer], void>;
    /**
     * Unconditional get.
     *
     * Creates the peer if not already present.
     */
    for(address: PeerAddress): Peer;
    has(item: PeerAddress | PeerDescriptor | Peer): boolean;
    get size(): number;
    find(predicate: (item: Peer) => boolean | undefined): Peer | undefined;
    filter(predicate: (item: Peer) => boolean | undefined): Peer[];
    map<T>(mapper: (item: Peer) => T): T[];
    [Symbol.iterator](): SetIterator<Peer>;
    get construction(): Construction<PeerSet>;
    static [Environmental.create](env: Environment): PeerSet;
    get peers(): BasicSet<Peer, Peer>;
    connect(address: PeerAddress, options: PeerConnectionOptions & {
        operationalAddress?: ServerAddressUdp;
    }): Promise<void>;
    /**
     * Obtain an exchange provider for the designated peer.
     * TODO enhance PeerConnectionOptions.discoveryOptions.discoveryData with "addresses" for known operational addresses
     */
    exchangeProviderFor(addressOrSession: PeerAddress | SecureSession, options?: PeerConnectionOptions): Promise<DedicatedChannelExchangeProvider | ReconnectableExchangeProvider>;
    /**
     * Retrieve a peer by address.
     */
    get(peer: PeerAddress | PeerDescriptor): Peer | undefined;
    close(): Promise<void>;
    addKnownPeer(address: PeerAddress, operationalServerAddress?: ServerAddressUdp, discoveryData?: DiscoveryData): void;
}
//# sourceMappingURL=PeerSet.d.ts.map