"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EdenNamespace = EdenNamespace;
exports.EdenHandler = EdenHandler;
require("reflect-metadata");
const CommandRegistry_1 = require("./CommandRegistry");
/**
 * Class decorator to set the namespace for all command handlers and events in a manager
 * @param namespace - The namespace for this manager (e.g., "process", "view")
 * @param options - Optional configuration including event interface
 *
 * @example
 * ```typescript
 * interface ProcessEvents {
 *   "launched": { appId: string };
 * }
 *
 * @EdenNamespace("process", { events: ProcessEvents })
 * class ProcessManager {
 *   @EdenHandler("launch")
 *   async handleLaunch(args: { appId: string }) {
 *     // This becomes "process/launch"
 *   }
 * }
 * ```
 */
function EdenNamespace(namespace, options) {
    return function (constructor) {
        (0, CommandRegistry_1.setManagerNamespace)(constructor, namespace);
        Reflect.defineMetadata("eden:namespace", namespace, constructor);
        // Store events interface name if provided for codegen
        if (options?.events) {
            Reflect.defineMetadata("eden:events", options.events, constructor);
        }
        return constructor;
    };
}
function EdenHandler(command, options) {
    return function (target, propertyKey, descriptor) {
        // Register this handler in metadata
        (0, CommandRegistry_1.addCommandHandler)(target.constructor, command, propertyKey);
        // Store permission metadata if provided
        if (options?.permission) {
            Reflect.defineMetadata("eden:handler:permission", options.permission, target, propertyKey);
        }
        return descriptor;
    };
}
//# sourceMappingURL=CommandDecorators.js.map