/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { InteractionClient } from "#cluster/client/InteractionClient.js";
import { AsyncObservable, Construction, Crypto, Diagnostic, Immutable, MatterError, Observable } from "@matter/general";
import { Behavior, ChangeNotificationService, ClientNode, Commands } from "@matter/node";
import { ClusterClientObj, DecodedAttributeReportValue, DecodedEventReportValue, Peer } from "@matter/protocol";
import { AttributeId, CaseAuthenticatedTag, ClusterId, ClusterType, EndpointNumber, EventId, NodeId } from "@matter/types";
import { BasicInformation } from "@matter/types/clusters/basic-information";
import { CommissioningController } from "../CommissioningController.js";
import { DeviceInformationData } from "./DeviceInformation.js";
import { Endpoint } from "./Endpoint.js";
export declare enum NodeStates {
    /**
     * Node seems active nd last communications were successful and subscription updates were received and all data is
     * up-to-date.
     */
    Connected = 0,
    /**
     * Node is disconnected. This means that the node was not connected so far or the developer disconnected it by API
     * call or the node is removed. A real disconnection cannot be detected because the main Matter protocol uses UDP.
     * Data are stale and interactions will most likely return an error.
     */
    Disconnected = 1,
    /**
     * Node is reconnecting. This means that former communications failed, and we are trying to reach the device on
     * known addresses. Data are stale. It is yet unknown if the reconnection is successful. */
    Reconnecting = 2,
    /**
     * The node seems offline because communication was not possible or is just initialized. The controller is now
     * waiting for a MDNS announcement and tries every 10 minutes to reconnect.
     */
    WaitingForDeviceDiscovery = 3
}
/** @deprecated */
export declare enum NodeStateInformation {
    /**
     * Node seems active nd last communications were successful and subscription updates were received and all data is
     * up-to-date.
     */
    Connected = 0,
    /**
     * Node is disconnected. This means that the node was not connected so far or the developer disconnected it by API
     * call or the node is removed. A real disconnection can not be detected because the main Matter protocol uses UDP.
     * Data are stale and interactions will most likely return an error.
     */
    Disconnected = 1,
    /**
     * Node is reconnecting. This means that former communications failed, and we are trying to reach the device on
     * known addresses. Data are stale. It is yet unknown if the reconnection is successful. */
    Reconnecting = 2,
    /**
     * The node seems offline because communication was not possible or is just initialized. The controller is now
     * waiting for a MDNS announcement and tries every 10 minutes to reconnect.
     */
    WaitingForDeviceDiscovery = 3,
    /**
     * Node structure has changed (Endpoints got added or also removed). Data are up-to-date.
     * This State information will only be fired when the subscribeAllAttributesAndEvents option is set to true.
     */
    StructureChanged = 4,
    /**
     * The node was just Decommissioned. This is a final state.
     */
    Decommissioned = 5
}
export type CommissioningControllerNodeOptions = {
    /**
     * Unless set to false the node will be automatically connected when initialized. When set to false use
     * connect() to connect to the node at a later timepoint.
     */
    readonly autoConnect?: boolean;
    /**
     * Unless set to false, all events and attributes are subscribed and value changes are reflected in the ClusterClient
     * instances. With this reading attributes values is mostly looked up in the locally cached data.
     * Additionally, more features like reaction on shutdown event or endpoint structure changes (for bridges) are done
     * internally automatically.
     */
    readonly autoSubscribe?: boolean;
    /**
     * Minimum subscription interval when values are changed. Default it is set to 1s.
     * If the device is intermittently connected, the minimum interval is always set to 0s because required by Matter specs.
     */
    readonly subscribeMinIntervalFloorSeconds?: number;
    /**
     * Maximum subscription interval when values are changed. This is also used as a keepalive mechanism to validate
     * that the device is still available. matter.js tries to set meaningful values based on the device type, connection
     * type, and other details. So ideally do not set this parameter unless you know it better.
     */
    readonly subscribeMaxIntervalCeilingSeconds?: number;
    /**
     * Optional additional callback method which is called for each Attribute change reported by the device. Use this
     * if subscribing to all relevant attributes is too much effort.
     * @deprecated Please use the events.attributeChanged observable instead.
     */
    readonly attributeChangedCallback?: (nodeId: NodeId, data: DecodedAttributeReportValue<any>) => void;
    /**
     * Optional additional callback method which is called for each Event reported by the device. Use this if
     * subscribing to all relevant events is too much effort.
     * @deprecated Please use the events.eventTriggered observable instead.
     */
    readonly eventTriggeredCallback?: (nodeId: NodeId, data: DecodedEventReportValue<any>) => void;
    /**
     * Optional callback method which is called when the state of the node changes. This can be used to detect when
     * the node goes offline or comes back online.
     * @deprecated Please use the events.stateChanged observable and the extra events for structureChanged and
     *  decommissioned instead.
     */
    readonly stateInformationCallback?: (nodeId: NodeId, state: NodeStateInformation) => void;
    /**
     * Optional Case Authenticated Tags (CATs) to be used when establishing CASE sessions with the node.
     * These tags provide additional authentication context for the operational session.
     */
    readonly caseAuthenticatedTags?: CaseAuthenticatedTag[];
};
export declare class NodeNotConnectedError extends MatterError {
}
/**
 * Class to represents one node that is paired/commissioned with the matter.js Controller. Instances are returned by
 * the CommissioningController on commissioning or when connecting.
 */
export declare class PairedNode {
    #private;
    [Diagnostic.value]: unknown;
    readonly nodeId: NodeId;
    readonly events: PairedNode.Events;
    static create(nodeId: NodeId, commissioningController: CommissioningController, options: CommissioningControllerNodeOptions | undefined, clientNode: ClientNode, interactionClient: InteractionClient, peer: Peer, crypto: Crypto, changes: Observable<[changes: ChangeNotificationService.Change]>): Promise<PairedNode>;
    constructor(nodeId: NodeId, commissioningController: CommissioningController, options: CommissioningControllerNodeOptions | undefined, clientNode: ClientNode, interactionClient: InteractionClient, peer: Peer, crypto: Crypto, changes: Observable<[changes: ChangeNotificationService.Change]>);
    get construction(): Construction<PairedNode>;
    get isConnected(): boolean;
    /** Returns the Node connection state. */
    get connectionState(): NodeStates;
    /** Returns the BasicInformation cluster metadata collected from the device. */
    get basicInformation(): {
        readonly dataModelRevision: number;
        readonly vendorName: string;
        readonly vendorId: import("@matter/types").VendorId;
        readonly productName: string;
        readonly productId: number;
        readonly nodeLabel: string;
        readonly location: string;
        readonly hardwareVersion: number;
        readonly hardwareVersionString: string;
        readonly softwareVersion: number;
        readonly softwareVersionString: string;
        readonly uniqueId: string;
        readonly capabilityMinima: {
            readonly caseSessionsPerFabric: number;
            readonly subscriptionsPerFabric: number;
        };
        readonly specificationVersion: number;
        readonly maxPathsPerInvoke: number;
        readonly configurationVersion: number;
        readonly manufacturingDate?: string | undefined;
        readonly partNumber?: string | undefined;
        readonly productUrl?: string | undefined;
        readonly productLabel?: string | undefined;
        readonly serialNumber?: string | undefined;
        readonly localConfigDisabled?: boolean | undefined;
        readonly reachable?: boolean | undefined;
        readonly productAppearance?: {
            readonly finish: BasicInformation.ProductFinish;
            readonly primaryColor: BasicInformation.Color | null;
        } | undefined;
    } | undefined;
    /** Returns the general capability metadata collected from the device. */
    get deviceInformation(): import("@matter/protocol").PhysicalDeviceProperties;
    /** Is the Node fully initialized with formerly stored subscription data? False when the node was never connected so far. */
    get localInitializationDone(): boolean;
    /** Is the Node fully initialized with remote subscription or read data? */
    get remoteInitializationDone(): boolean;
    /** Is the Node initialized - locally or remotely? */
    get initialized(): boolean;
    get id(): string;
    get node(): ClientNode;
    /** If a subscription is established, then this is the interval in seconds, otherwise undefined */
    get currentSubscriptionIntervalSeconds(): number | undefined;
    /**
     * Schedule a connection to the device. This method is non-blocking and will return immediately.
     * The connection happens in the background. Please monitor the state events of the node to see if the
     * connection was successful.
     * The provided connection options will be set and used internally if the node reconnects successfully.
     */
    connect(connectOptions?: CommissioningControllerNodeOptions): void;
    /**
     * Trigger a reconnection to the device. This method is non-blocking and will return immediately.
     * The reconnection happens in the background. Please monitor the state events of the node to see if the
     * reconnection was successful.
     */
    triggerReconnect(): void;
    /**
     * Force a reconnection by tearing down and re-establishing the sustained subscription.
     */
    reconnect(connectOptions?: CommissioningControllerNodeOptions): Promise<void>;
    /**
     * Request the current InteractionClient for custom special interactions with the device. Usually the
     * ClusterClients of the Devices of the node should be used instead. An own InteractionClient is only needed
     * when you want to read or write multiple attributes or events in a single request or send batch invokes.
     */
    getInteractionClient(): InteractionClient;
    /** Method to log the structure of this node with all endpoints and clusters. */
    logStructure(): void;
    /**
     * Subscribe to all attributes and events of the device. Unless setting the Controller property autoSubscribe to
     * false, this is executed automatically. Alternatively, you can manually subscribe by calling this method.
     *
     * @deprecated Subscription is now managed by NetworkClient on the ClientNode. Use connect() to activate.
     */
    subscribeAllAttributesAndEvents(_options?: {
        ignoreInitialTriggers?: boolean;
        attributeChangedCallback?: (data: DecodedAttributeReportValue<any>) => void;
        eventTriggeredCallback?: (data: DecodedEventReportValue<any>) => void;
    }): Promise<number | undefined>;
    /** Returns all parts (endpoints) known for the Root Endpoint of this node. */
    get parts(): Map<number, Endpoint>;
    /** Returns the functional devices/endpoints (the "children" of the Root Endpoint) known for this node. */
    getDevices(): Endpoint[];
    /** Returns the device/endpoint with the given endpoint ID. */
    getDeviceById(endpointId: number): Endpoint | undefined;
    /** Returns the Root Endpoint of the device. */
    getRootEndpoint(): Endpoint | undefined;
    /** De-Commission (unpair) the device from this controller by removing the fabric from the device. */
    decommission(): Promise<void>;
    /**
     * Opens a Basic Commissioning Window (uses the original Passcode printed on the device) with the device.
     * This is an optional method, so it might not be supported by all devices and could be rejected with an error in
     * this case! Better use openEnhancedCommissioningWindow() instead.
     */
    openBasicCommissioningWindow(commissioningTimeout?: number): Promise<void>;
    /** Opens an Enhanced Commissioning Window (uses a generated random Passcode) with the device. */
    openEnhancedCommissioningWindow(commissioningTimeout?: number): Promise<{
        manualPairingCode: string;
        qrPairingCode: string;
    }>;
    /** Closes the current session, ends the subscription and disconnects the device. */
    disconnect(): Promise<void>;
    /** Closes the subscription and ends all timers used by this PairedNode instance. */
    close(sendDecommissionedStatus?: boolean): void;
    /**
     * Get a cluster client from the root endpoint. This is mainly used internally and not needed to be called by the user.
     *
     * @param cluster ClusterClient to get or undefined if not existing
     */
    getRootClusterClient<const N extends ClusterType.Concrete>(cluster: N): ClusterClientObj<N["Typing"]> | undefined;
    /**
     * Get a cluster client from the root endpoint. This is mainly used internally and not needed to be called by the user.
     *
     * @param endpointId EndpointNumber to get the cluster from
     * @param cluster ClusterClient to get or undefined if not existing
     */
    getClusterClientForDevice<const N extends ClusterType.Concrete>(endpointId: EndpointNumber, cluster: N): ClusterClientObj<N["Typing"]> | undefined;
    /**
     * Access to cached cluster state values of the root endpoint using node.state.clusterNameOrId.attributeNameOrId
     * Returns immutable cached attribute values from cluster clients
     */
    get state(): {
        readonly parts: {};
        readonly index: {};
        readonly commissioning: {
            readonly peerAddress?: {
                readonly fabricIndex: import("@matter/types").FabricIndex;
                readonly nodeId: NodeId;
            } | undefined;
            readonly caseAuthenticatedTags?: readonly CaseAuthenticatedTag[] | undefined;
            readonly addresses?: readonly ({
                readonly type: "udp";
                readonly ip: string;
                readonly port: number;
                readonly healthyAt?: import("@matter/general").Timestamp | undefined;
                readonly unhealthyAt?: import("@matter/general").Timestamp | undefined;
                readonly priority?: number | undefined;
                readonly weight?: number | undefined;
                readonly discoveredAt?: import("@matter/general").Timestamp | undefined;
                readonly ttl?: import("@matter/general").Duration | undefined;
            } | {
                readonly type: "tcp";
                readonly ip: string;
                readonly port: number;
                readonly healthyAt?: import("@matter/general").Timestamp | undefined;
                readonly unhealthyAt?: import("@matter/general").Timestamp | undefined;
                readonly priority?: number | undefined;
                readonly weight?: number | undefined;
                readonly discoveredAt?: import("@matter/general").Timestamp | undefined;
                readonly ttl?: import("@matter/general").Duration | undefined;
            } | {
                readonly type: "ble";
                readonly peripheralAddress: string;
                readonly healthyAt?: import("@matter/general").Timestamp | undefined;
                readonly unhealthyAt?: import("@matter/general").Timestamp | undefined;
                readonly priority?: number | undefined;
                readonly weight?: number | undefined;
                readonly discoveredAt?: import("@matter/general").Timestamp | undefined;
                readonly ttl?: import("@matter/general").Duration | undefined;
            })[] | undefined;
            readonly discoveredAt?: import("@matter/general").Timestamp | undefined;
            readonly onlineAt?: import("@matter/general").Timestamp | undefined;
            readonly offlineAt?: import("@matter/general").Timestamp | undefined;
            readonly commissionedAt?: import("@matter/general").Timestamp | undefined;
            readonly ttl?: import("@matter/general").Duration | undefined;
            readonly deviceIdentifier?: string | undefined;
            readonly discriminator?: number | undefined;
            readonly commissioningMode?: import("@matter/protocol").CommissioningMode | undefined;
            readonly vendorId?: import("@matter/types").VendorId | undefined;
            readonly productId?: number | undefined;
            readonly deviceType?: import("@matter/types").DeviceTypeId | undefined;
            readonly deviceName?: string | undefined;
            readonly rotatingIdentifier?: string | undefined;
            readonly pairingHint?: number | undefined;
            readonly pairingInstructions?: string | undefined;
            readonly sessionParameters?: {
                readonly idleInterval?: import("@matter/general").Duration | undefined;
                readonly activeInterval?: import("@matter/general").Duration | undefined;
                readonly activeThreshold?: import("@matter/general").Duration | undefined;
                readonly dataModelRevision?: number | undefined;
                readonly interactionModelRevision?: number | undefined;
                readonly specificationVersion?: number | undefined;
                readonly maxPathsPerInvoke?: number | undefined;
                readonly supportedTransports?: {
                    readonly tcpClient?: boolean | undefined;
                    readonly tcpServer?: boolean | undefined;
                } | undefined;
                readonly maxTcpMessageSize?: number | undefined;
            } | undefined;
            readonly tcpSupport?: number | undefined;
            readonly longIdleTimeOperatingMode?: boolean | undefined;
        };
        readonly network: {
            readonly defaultSubscription?: {
                readonly keepSubscriptions: boolean;
                readonly minIntervalFloor?: import("@matter/general").Duration | undefined;
                readonly maxIntervalCeiling?: import("@matter/general").Duration | undefined;
                readonly updated?: ((data: import("@matter/protocol").ReadResult) => Promise<void>) | undefined;
                readonly closed?: (() => void) | undefined;
                readonly interactionModelRevision: number;
                readonly isFabricFiltered: boolean;
                readonly attributeRequests?: readonly {
                    readonly clusterId?: ClusterId | undefined;
                    readonly attributeId?: AttributeId | undefined;
                    readonly enableTagCompression?: boolean | undefined;
                    readonly nodeId?: NodeId | undefined;
                    readonly endpointId?: EndpointNumber | undefined;
                    readonly listIndex?: number | null | undefined;
                    readonly wildcardPathFlags?: {
                        readonly skipRootNode?: boolean | undefined;
                        readonly skipGlobalAttributes?: boolean | undefined;
                        readonly skipAttributeList?: boolean | undefined;
                        readonly reserved1?: boolean | undefined;
                        readonly skipCommandLists?: boolean | undefined;
                        readonly skipCustomElements?: boolean | undefined;
                        readonly skipFixedAttributes?: boolean | undefined;
                        readonly skipChangesOmittedAttributes?: boolean | undefined;
                        readonly skipDiagnosticsClusters?: boolean | undefined;
                    } | undefined;
                }[] | undefined;
                readonly eventRequests?: readonly {
                    readonly clusterId?: ClusterId | undefined;
                    readonly nodeId?: NodeId | undefined;
                    readonly endpointId?: EndpointNumber | undefined;
                    readonly eventId?: EventId | undefined;
                    readonly isUrgent?: boolean | undefined;
                }[] | undefined;
                readonly eventFilters?: readonly {
                    readonly eventMin: number | bigint;
                    readonly nodeId?: NodeId | undefined;
                }[] | undefined;
                readonly dataVersionFilters?: readonly {
                    readonly path: {
                        readonly clusterId: ClusterId;
                        readonly endpointId: EndpointNumber;
                        readonly nodeId?: NodeId | undefined;
                    };
                    readonly dataVersion: number;
                }[] | undefined;
            } | {
                readonly keepSubscriptions?: boolean | undefined;
                readonly minIntervalFloor?: import("@matter/general").Duration | undefined;
                readonly maxIntervalCeiling?: import("@matter/general").Duration | undefined;
                readonly update?: ((data: import("@matter/protocol").ReadResult) => Promise<void>) | undefined;
                readonly closed?: (() => void) | undefined;
                readonly attributes?: readonly {
                    readonly clusterId?: ClusterId | undefined;
                    readonly attributeId?: AttributeId | undefined;
                    readonly enableTagCompression?: boolean | undefined;
                    readonly nodeId?: NodeId | undefined;
                    readonly endpointId?: EndpointNumber | undefined;
                    readonly listIndex?: number | null | undefined;
                    readonly wildcardPathFlags?: {
                        readonly skipRootNode?: boolean | undefined;
                        readonly skipGlobalAttributes?: boolean | undefined;
                        readonly skipAttributeList?: boolean | undefined;
                        readonly reserved1?: boolean | undefined;
                        readonly skipCommandLists?: boolean | undefined;
                        readonly skipCustomElements?: boolean | undefined;
                        readonly skipFixedAttributes?: boolean | undefined;
                        readonly skipChangesOmittedAttributes?: boolean | undefined;
                        readonly skipDiagnosticsClusters?: boolean | undefined;
                    } | undefined;
                }[] | undefined;
                readonly versionFilters?: readonly {
                    readonly path: {
                        readonly clusterId: ClusterId;
                        readonly endpointId: EndpointNumber;
                        readonly nodeId?: NodeId | undefined;
                    };
                    readonly dataVersion: number;
                }[] | undefined;
                readonly events?: readonly {
                    readonly clusterId?: ClusterId | undefined;
                    readonly nodeId?: NodeId | undefined;
                    readonly endpointId?: EndpointNumber | undefined;
                    readonly eventId?: EventId | undefined;
                    readonly isUrgent?: boolean | undefined;
                }[] | undefined;
                readonly eventFilters?: readonly {
                    readonly eventMin: number | bigint;
                    readonly nodeId?: NodeId | undefined;
                }[] | undefined;
                readonly fabricFilter?: boolean | undefined;
                readonly interactionModelRevision?: number | undefined;
            } | undefined;
            readonly isDisabled: boolean;
            readonly autoSubscribe: boolean;
            readonly maxEventNumber: import("@matter/types").EventNumber;
            readonly port: number;
            readonly operationalPort: number;
        };
        readonly descriptor: {
            readonly deviceTypeList: readonly {
                readonly deviceType: import("@matter/types").DeviceTypeId;
                readonly revision: number;
            }[];
            readonly serverList: readonly ClusterId[];
            readonly clientList: readonly ClusterId[];
            readonly partsList: readonly EndpointNumber[];
            readonly endpointUniqueId?: string | undefined;
        };
    };
    /**
     * Access to cluster commands of the root endpoint using node.commands.clusterNameOrId.commandName
     * Returns async functions that can be called to invoke commands on cluster clients
     */
    get commands(): Commands<ClientNode.RootEndpoint>;
    /**
     * Access to typed cached cluster state values of the root endpoint
     * Returns immutable cached attribute values from cluster clients
     */
    stateOf<T extends Behavior.Type>(type: T): Immutable<InstanceType<T["State"]>>;
    /**
     * Access to typed cluster commands of the root endpoint
     * Returns async functions that can be called to invoke commands on cluster clients
     */
    commandsOf<T extends Behavior.Type>(type: T): Commands.OfBehavior<T>;
}
export declare namespace PairedNode {
    interface NodeStructureEvents {
        /** Emitted when endpoints are added. */
        nodeEndpointAdded: Observable<[EndpointNumber]>;
        /** Emitted when endpoints are removed. */
        nodeEndpointRemoved: Observable<[EndpointNumber]>;
        /** Emitted when endpoints are updated (e.g. device type changed, structure changed). */
        nodeEndpointChanged: Observable<[EndpointNumber]>;
    }
    interface Events extends NodeStructureEvents {
        /**
         * Emitted when the node is initialized from local data. These data usually are stale, but you can still already
         * use the node to interact with the device. If no local data are available this event will be emitted together
         * with the initializedFromRemote event.
         */
        initialized: AsyncObservable<[details: DeviceInformationData]>;
        /**
         * Emitted when the node is fully initialized from remote and all attributes and events are subscribed.
         * This event can also be awaited if code needs to be blocked until the node is fully initialized.
         */
        initializedFromRemote: AsyncObservable<[details: DeviceInformationData]>;
        /**
         * Emitted when the device information changes.
         */
        deviceInformationChanged: AsyncObservable<[details: DeviceInformationData]>;
        /** Emitted when the state of the node changes. */
        stateChanged: Observable<[nodeState: NodeStates]>;
        /** Emitted when an attribute value changes. */
        attributeChanged: Observable<[data: DecodedAttributeReportValue<any>]>;
        /** Emitted when an event is triggered. */
        eventTriggered: Observable<[DecodedEventReportValue<any>]>;
        /**
         * Emitted when all node structure changes were applied (Endpoints got added or also removed).
         * You can alternatively use the nodeEndpointAdded, nodeEndpointRemoved, and nodeEndpointChanged events to react on specific changes.
         * This event is emitted after all nodeEndpointAdded, nodeEndpointRemoved, and nodeEndpointChanged events are emitted.
         */
        structureChanged: Observable<[void]>;
        /** Emitted when the node is decommissioned. */
        decommissioned: Observable<[void]>;
        /** Emitted when a subscription alive trigger is received (max interval trigger or any data update) */
        connectionAlive: Observable<[void]>;
    }
}
//# sourceMappingURL=PairedNode.d.ts.map