import { SceneObjectCreate } from "./sceneObjectCreate.js"; import { SceneObjectUpdate } from "./sceneObjectUpdate.js"; import { SchemaKind, SchemaVersion } from "./types/sceneObjectSchemas.js"; /** * Operation types for bulk scene object updates */ export declare enum OperationType { CREATE = "add", UPDATE = "update", DELETE = "remove" } /** * Base interface for scene object operations */ export interface SceneObjectOperationBase { op: OperationType; } /** * Operation to create a new scene object * * @example * ```typescript * const createStylingObject: CreateSceneObjectOperation<'ExpressionStyling', '1.0.0'> = { * op: OperationType.CREATE, * payload: { * id: '', // Optional, will be auto-generated if not provided * kind: 'ExpressionStyling', * version: '1.0.0', * relatedId: '', * data: { stylingOptions: { styleType: "Expression", show: 'element.category === "Door"' } } * } * }; * ``` */ export interface CreateSceneObjectOperation = SchemaVersion> extends SceneObjectOperationBase { /** Operation type */ op: OperationType.CREATE; /** Scene object creation payload */ payload: SceneObjectCreate; } /** * Operation to update an existing scene object * * @example * ```typescript * const updateStyling: UpdateSceneObjectOperation<'ExpressionStyling', '1.0.0'> = { * op: OperationType.UPDATE, * id: '', * payload: { * displayName: 'Updated ExpressionStyling', * data: { stylingOptions: { styleType: "Expression", show: 'element.category === "Door"' } } * } * }; * ``` */ export interface UpdateSceneObjectOperation = SchemaVersion> extends SceneObjectOperationBase { /** Operation type */ op: OperationType.UPDATE; /** Id of the scene object to update (UUID) */ id: string; /** Scene object partial update payload */ payload: SceneObjectUpdate; } /** * Operation to delete a scene object * * @example * ```typescript * const deleteOperation: DeleteSceneObjectOperation = { * op: OperationType.DELETE, * id: '' * }; * ``` */ export interface DeleteSceneObjectOperation extends SceneObjectOperationBase { /** Operation type */ op: OperationType.DELETE; /** Id of the scene object to delete (UUID) */ id: string; } /** * Union type for all scene object operations */ export type SceneObjectOperation = CreateSceneObjectOperation | UpdateSceneObjectOperation | DeleteSceneObjectOperation; /** * Interface for updating multiple scene objects in bulk using atomic operations. * All operations are executed in the order provided. * * @example * ```typescript * const bulkUpdate: BulkSceneObjectOperations = { * operations: [ * // 1. Create a new scene object * { op: 'add', payload: { displayName: 'My New Layer', id: '', ... } }, * // 2. Move existing object to the new layer * { op: 'update', id: '', payload: { parentId: '' } }, * // 3. Remove old layer * { op: 'remove', id: ''} * ] * }; * ``` */ export interface BulkSceneObjectOperations { /** Array of scene object operations to perform. */ operations: SceneObjectOperation[]; }