/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { type ClusterBehavior } from "#behavior/cluster/ClusterBehavior.js";
import { RemoteDescriptor } from "#behavior/system/commissioning/RemoteDescriptor.js";
import { CommissioningDiscovery } from "#behavior/system/controller/discovery/CommissioningDiscovery.js";
import { ContinuousDiscovery } from "#behavior/system/controller/discovery/ContinuousDiscovery.js";
import { Discovery } from "#behavior/system/controller/discovery/Discovery.js";
import { InstanceDiscovery } from "#behavior/system/controller/discovery/InstanceDiscovery.js";
import { PaseDiscovery } from "#behavior/system/controller/discovery/PaseDiscovery.js";
import { Endpoint } from "#endpoint/Endpoint.js";
import { EndpointContainer } from "#endpoint/properties/EndpointContainer.js";
import { EndpointType } from "#endpoint/type/EndpointType.js";
import { MaybePromise, Observable } from "@matter/general";
import { PeerAddress } from "@matter/protocol";
import { ClientNode } from "../ClientNode.js";
import type { ServerNode } from "../ServerNode.js";
/**
 * Manages the set of known remote nodes.
 *
 * Remote nodes are either peers (commissioned into a fabric we share) or commissionable.
 */
export declare class Peers extends EndpointContainer<ClientNode> {
    #private;
    constructor(owner: ServerNode);
    /**
     * Load nodes.  Invoked automatically by owner.
     */
    initialize(): void;
    /**
     * Find a specific commissionable node, or, if no discovery options are provided, returns the first discovered node.
     * TODO: Allow to provide an array of options for multiple discoveries (e.g. from a Multi QR code).
     */
    locate(options?: Discovery.Options): InstanceDiscovery;
    /**
     * Employ discovery to find a set of commissionable nodes, the options can be used to limit the discovered devices
     * (e.g. just a specific vendor).
     * TODO: Allow to provide multiple identifiers for multiple discoveries (e.g. from a Multi QR code).
     *
     * If you do not provide a timeout value, will search until canceled, and you need to add a listener to
     * {@link Discovery#discovered} or {@link added} to receive discovered nodes.
     */
    discover(options?: Discovery.Options): ContinuousDiscovery;
    /**
     * Find a specific commissionable node and commission.
     */
    commission(options: CommissioningDiscovery.Options): CommissioningDiscovery;
    /**
     * Find a specific commissionable node and establish a PASE session without commissioning.
     *
     * Useful for split-commissioning scenarios where one controller establishes PASE and another
     * performs the commissioning flow, or for raw PASE channel establishment.
     */
    pase(options: PaseDiscovery.Options): PaseDiscovery;
    /**
     * Find or create a {@link ClientNode} for a device described by {@link descriptor}.
     *
     * If a matching node already exists in the peer collection, returns it after refreshing its addresses and
     * discovery data from the supplied descriptor.  Otherwise creates a new node using the descriptor.
     *
     * After calling {@link forDescriptor}, commission the returned node via {@link ClientNode.commission}.
     */
    forDescriptor(descriptor: RemoteDescriptor): Promise<ClientNode>;
    /**
     * Obtain an {@link Observable} that emits when a specific type of endpoint initializes for a peer.
     *
     * This is useful for initializing general behavior on any peer endpoint of the specified type.
     */
    endpointInstalled<T extends EndpointType>(type: T): Observable<[endpoint: Endpoint<T>]>;
    /**
     * Obtain a {@link Observable} that emits when a specific type of cluster initializes for a peer.
     *
     * This is useful for initializing general behavior on any peer endpoint with the specified cluster.
     */
    clusterInstalled<T extends ClusterBehavior.Type>(type: T): Observable<[endpoint: Endpoint<EndpointType.Empty>, type: T], void>;
    /**
     * Emits when fixed attributes
     */
    get(id: number | string | PeerAddress): ClientNode | undefined;
    get owner(): ServerNode;
    add(node: ClientNode): void;
    /**
     * Get or create a client node for the given peer address.
     *
     * This is mainly used to communicate to other known nodes on the fabric without having a formal commissioning
     * process.
     */
    forAddress(peerAddress: PeerAddress, options?: Omit<ClientNode.Options, "owner">): Promise<ClientNode>;
    close(): Promise<void>;
    /**
     * Run a commission attempt on {@link node} while protecting the node from the expired-node cull.
     *
     * Serialization is done through the same {@link #mutex} the cull uses: the busy registration runs as a mutex task,
     * which guarantees no cull is in flight when we register and that any subsequent cull observes the busy flag.
     *
     * Rejects with {@link CommissioningError} if the node is already mid-commission (parallel attempts on the same
     * {@link ClientNode} would race on device-side state) or if a cull queued ahead of us already destroyed/crashed
     * the node.  Either way the attempt fails fast instead of crashing later when the closed backing is accessed.
     */
    runCommissioning<T>(node: ClientNode, fn: () => MaybePromise<T>): Promise<T>;
}
//# sourceMappingURL=Peers.d.ts.map