/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ClusterBehavior } from "#behavior/cluster/ClusterBehavior.js";
import { BasicSet, MaybePromise, ObserverGroup } from "@matter/general";
import { Val } from "@matter/protocol";
import { AttributeId, ClusterId, FabricIndex, GroupId, TlvSchema } from "@matter/types";
import { ScenesManagement } from "@matter/types/clusters/scenes-management";
/** Internal meta information for sceneable attributes on the endpoint */
type AttributeDetails = {
    id: AttributeId;
    name: string;
    schema: TlvSchema<any>;
    type: string;
    mappedType: AttributeValuePairDataFields;
    nullable: boolean;
};
/** Enum for the allowed fields in AttributeValuePair */
declare const enum AttributeValuePairDataFields {
    ValueUnsigned8 = "valueUnsigned8",
    ValueSigned8 = "valueSigned8",
    ValueUnsigned16 = "valueUnsigned16",
    ValueSigned16 = "valueSigned16",
    ValueUnsigned32 = "valueUnsigned32",
    ValueSigned32 = "valueSigned32",
    ValueUnsigned64 = "valueUnsigned64",
    ValueSigned64 = "valueSigned64"
}
/** Mapping from Datatypes to the AttributeValuePair field to use and expect */
export declare const DataTypeToSceneAttributeDataMap: Record<string, AttributeValuePairDataFields | undefined>;
declare const ScenesManagementBase: ClusterBehavior.Type<ClusterBehavior.Type<import("./ScenesManagementBehavior.js").ScenesManagementBehaviorConstructor, ScenesManagement, typeof ScenesManagement, new () => {}, "scenesManagement"> & {
    readonly id: "scenesManagement";
}, import("@matter/types").ClusterType.WithSupportedFeatures<ScenesManagement, {
    sceneNames: true;
}>, import("@matter/types").ClusterType.Concrete, new () => {}, "scenesManagement">;
/**
 * This is the default server implementation of {@link ScenesManagementBehavior}.
 * We implement the full Scenes Management cluster as specified in the Matter Spec.
 * The SceneName feature is enabled by default.
 *
 * When a scene is applied/recalled then the relevant clusters are informed via the "applySceneValues" event they need
 * to implement. If they do not implement the scene is not applied for that cluster.
 */
export declare class ScenesManagementServer extends ScenesManagementBase {
    #private;
    readonly state: ScenesManagementServer.State;
    protected internal: ScenesManagementServer.Internal;
    initialize(): void;
    /**
     * Handles removal of one group in a fabric.
     * This method is called by the GroupsServer implementation and also internally by this cluster.
     */
    removeScenesForGroupOnFabric(fabricIndex: FabricIndex, groupId: GroupId): void;
    /** Handles removal of all groups in a fabric. This method is called by the GroupsServer implementation. */
    removeScenesForAllGroupsForFabric(fabricIndex: FabricIndex): void;
    /** Implements the AddScene command */
    addScene({ groupId: reqGroupId, sceneId, sceneName, transitionTime, extensionFieldSetStructs }: ScenesManagement.AddSceneRequest): ScenesManagement.AddSceneResponse;
    /** Implements the ViewScene command */
    viewScene({ groupId: reqGroupId, sceneId }: ScenesManagement.ViewSceneRequest): ScenesManagement.ViewSceneResponse;
    /** Implements the RemoveScene command */
    removeScene({ groupId: reqGroupId, sceneId }: ScenesManagement.RemoveSceneRequest): ScenesManagement.RemoveSceneResponse;
    /** Implements the RemoveAllScenes command */
    removeAllScenes({ groupId: reqGroupId }: ScenesManagement.RemoveAllScenesRequest): ScenesManagement.RemoveAllScenesResponse;
    /** Implements the StoreScene command */
    storeScene({ groupId: reqGroupId, sceneId }: ScenesManagement.StoreSceneRequest): ScenesManagement.StoreSceneResponse;
    /** Implements the RecallScene command */
    recallScene({ groupId: reqGroupId, sceneId, transitionTime }: ScenesManagement.RecallSceneRequest): Promise<void>;
    /** Implements the GetSceneMembership command */
    getSceneMembership({ groupId: reqGroupId }: ScenesManagement.GetSceneMembershipRequest): ScenesManagement.GetSceneMembershipResponse;
    /** Implements the CopyScene command */
    copyScene({ mode, groupIdentifierFrom, sceneIdentifierFrom, groupIdentifierTo, sceneIdentifierTo }: ScenesManagement.CopySceneRequest): ScenesManagement.CopySceneResponse;
    /** Close the observers */
    [Symbol.asyncDispose](): Promise<void>;
    /** Method used by the OnOff cluster to recall the global scene */
    recallGlobalScene(fabricIndex: FabricIndex): Promise<void>;
    /** Method used by the OnOff cluster to store the global scene */
    storeGlobalScene(fabricIndex: FabricIndex): void;
    /**
     * Main method for Clusters to Register themselves with their "Apply Scenes Callback".
     *
     * @param behavior ClusterBehavior implementing a cluster with sceneable attributes
     * @param applyFunc Function that applies scene values for that cluster
     */
    implementScenes<T extends ClusterBehavior>(behavior: T, applyFunc: ScenesManagementServer.ApplySceneValuesFunc<T>): void;
    /**
     * Invalidate all fabric scene info entries.
     * Method will be called by relevant clusters when commands change the state.
     */
    makeAllFabricSceneInfoEntriesInvalid(): void;
}
export declare namespace ScenesManagementServer {
    /** Scene Attribute Data format used internally to store scene attribute values */
    type SceneAttributeData = {
        [key: string]: {
            [key: string]: boolean | number | bigint | null;
        };
    };
    /** Scene Table Entry as decorated class for persistence */
    class ScenesTableEntry implements Omit<ScenesManagement.LogicalSceneTable, "extensionFields"> {
        sceneGroupId: GroupId;
        sceneId: number;
        sceneName?: string;
        sceneTransitionTime: number;
        sceneValues: SceneAttributeData;
        fabricIndex: FabricIndex;
    }
    class State extends ScenesManagementBase.State {
        sceneTable: ScenesTableEntry[];
    }
    type ApplySceneValuesFunc<T extends ClusterBehavior> = (this: T, values: Val.Struct, transitionTime: number) => MaybePromise;
    class Internal {
        /** ObserverGroup for all $Changed events of sceneable attributes */
        endpointSceneAttributeObservers: ObserverGroup;
        /** Fabric index where a scene is currently valid, if any */
        monitorSceneAttributesForFabric: FabricIndex | null;
        /** Map of sceneable behaviors/clusters and their sceneable attributes on the endpoint */
        endpointSceneableBehaviors: BasicSet<{
            id: ClusterId;
            name: string;
            attributes: BasicSet<AttributeDetails>;
            clusterBehaviorType: ClusterBehavior.Type;
            applyFunc: ApplySceneValuesFunc<any>;
        }, {
            id: ClusterId;
            name: string;
            attributes: BasicSet<AttributeDetails>;
            clusterBehaviorType: ClusterBehavior.Type;
            applyFunc: ApplySceneValuesFunc<any>;
        }>;
    }
}
export {};
//# sourceMappingURL=ScenesManagementServer.d.ts.map