/** * 强类型命令工厂 * * 提供类型安全的命令创建和验证功能 */ import type { CommandTypeMap, SpecificCommand } from './command-types'; import type { CommandMessage, Priority } from './index'; import { OperationType } from './index'; /** * 强类型命令消息工厂 */ export declare class TypedCommandFactory { /** * 创建强类型命令消息 */ static createTypedCommandMessage(requestRef: string, targetClientId: string, commandCode: T, commandProps: Omit, options?: { priority?: Priority; timeout?: number; callback?: string; }): CommandMessage; /** * 示例:创建命令的工厂方法 * * 实际使用时,应该为每个从 C# 生成的命令创建对应的工厂方法 * 例如: createLedSwitchCommand, createBlockPlayCommand 等 */ static createExampleCommand(requestRef: string, targetClientId: string, deviceId: number, exampleField: string, exampleValue: number, operationType?: OperationType, options?: { priority?: Priority; timeout?: number; callback?: string; }): CommandMessage; } /** * 命令类型验证器 */ export declare class CommandTypeValidator { /** * 验证命令是否符合强类型定义 */ static validateCommand(command: any): { valid: boolean; errors: string[]; }; private static validateExampleCommand; } /** * 命令类型转换器 */ export declare class CommandTypeConverter { /** * 将通用命令转换为强类型命令 */ static toTypedCommand(genericCommand: any): SpecificCommand | null; /** * 检查命令是否为强类型命令 */ static isTypedCommand(command: any): command is SpecificCommand; } export declare const createExampleCommand: typeof TypedCommandFactory.createExampleCommand; export declare const validateCommand: typeof CommandTypeValidator.validateCommand; export declare const toTypedCommand: typeof CommandTypeConverter.toTypedCommand; //# sourceMappingURL=command-factory.d.ts.map