import { ESPCDF } from "./index"; import { ESPCDFScene } from "../entities/ESPCDFScene"; /** * SceneStore - Manages scene operations and state for ESP Rainmaker CDF * * This store handles all scene-related operations including: * - Scene CRUD operations (Create, Read, Update, Delete) * - Scene transformation from node configurations * - Scene activation and synchronization * - Payload generation for scene operations * - Interceptor patterns for scene actions */ declare class SceneStore { #private; /** Index signature for dynamic property access */ [key: string]: any; /** Observable map of scenes indexed by scene ID */ accessor _scenesByID: { [key: string]: ESPCDFScene; }; /** * Creates a new SceneStore instance * @param [rootStore] - Optional reference to the root CDF store */ constructor(rootStore?: ESPCDF); /** Releases this store's entity subscriptions. Called by `ESPCDF.dispose`. */ dispose(): void; /** * Getter for scenes indexed by ID * @returns Map of scenes indexed by scene ID */ get scenesByID(): { [key: string]: ESPCDFScene; }; /** * Setter for scenes indexed by ID * @param value - Map of scenes to set */ set scenesByID(value: { [key: string]: ESPCDFScene; }); /** * Computed property that returns an array of all scenes * @returns Array of all scenes in the store */ get sceneList(): ESPCDFScene[]; /** * Retrieves a scene by its ID * @param sceneId - The ID of the scene to retrieve * @returns The scene object or null if not found * @example * const scene = sceneStore.getScene('scene123'); */ getScene: (sceneId: string) => ESPCDFScene | null; /** * Sets the entire scene list, replacing all existing scenes * * This method replaces all scenes in the store with the provided array. * Each scene is made observable and has interceptors set up. * @param scenes - Array of scenes to set * @example * sceneStore.setSceneList([ * { id: 'scene1', name: 'Scene 1', nodes: [], actions: {} }, * { id: 'scene2', name: 'Scene 2', nodes: [], actions: {} } * ]); */ setSceneList(scenes: ESPCDFScene[]): void; /** * Adds a single scene to the store * @param scene - The scene to add * @returns The observable scene object * @example * const scene = sceneStore.addScene(sceneEntity); */ addScene(scene: ESPCDFScene): ESPCDFScene; /** * Updates a scene by ID without making it observable * @param id - The scene ID * @param scene - The scene object to set * @example * sceneStore.updateSceneByID('scene123', updatedScene); */ updateSceneByID(id: string, scene: ESPCDFScene): void; /** * Deletes multiple scenes by their IDs * @param ids - Array of scene IDs to delete * @example * sceneStore.deleteScenes(['scene1', 'scene2', 'scene3']); */ deleteScenes(ids: string[]): void; /** * Activates a scene by triggering its action * * This method finds the scene by ID and calls its trigger method, which * will activate the scene across all its associated nodes. * @param sceneId - The ID of the scene to activate * @returns Resolves when `scene.activate()` completes for that scene * @throws {Error} If scene is not found or activation fails * @example * await sceneStore.activateScene('scene123'); */ activateScene: (sceneId: string) => Promise; /** * Activates multiple scenes concurrently * * This method activates multiple scenes in parallel using Promise.all. * @param sceneIds - Array of scene IDs to activate * @returns Resolves when every scene in the list has been activated * @throws {Error} If any scene activation fails * @example * await sceneStore.activateMultipleScenes(['scene1', 'scene2', 'scene3']); */ activateMultipleScenes: (sceneIds: string[]) => Promise; /** * Dynamically adds an observable property to the store * * This method adds a new observable property to the store and automatically * creates getter and setter methods for it. The property name is capitalized * for the getter/setter methods. * @param propertyName - The name of the property to add * @param initialValue - The initial value for the property * @example * sceneStore.addProperty('customField', 'initial value'); * sceneStore.setCustomField('new value'); */ addProperty(propertyName: string, initialValue: any): void; /** * Clears all scenes and resets hooks to default values * * This method removes all scenes from the store and resets the * beforeSetSceneListHook and afterSetSceneListHook to empty functions. * @example * sceneStore.clear(); */ clear(): void; } export default SceneStore;