"use strict";
/**
 * Target Registry
 *
 * Map-based registry for target adapters.
 * Adapters self-register at startup; lookup is O(1).
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRegisteredTargets = exports.hasTarget = exports.getDefaultTarget = exports.getTarget = exports.registerTarget = void 0;
const adapters = new Map();
/**
 * Register a target adapter. Overwrites if already registered.
 */
function registerTarget(adapter) {
    adapters.set(adapter.type, adapter);
}
exports.registerTarget = registerTarget;
/**
 * Get a registered target adapter by type.
 * @throws Error if target type is not registered
 */
function getTarget(type) {
    const adapter = adapters.get(type);
    if (!adapter) {
        const available = Array.from(adapters.keys()).join(', ');
        throw new Error(`Unknown target "${type}". Available: ${available}`);
    }
    return adapter;
}
exports.getTarget = getTarget;
/**
 * Get the default target adapter ('claude').
 * @throws Error if claude adapter is not registered
 */
function getDefaultTarget() {
    return getTarget('claude');
}
exports.getDefaultTarget = getDefaultTarget;
/**
 * Check if a target type is registered.
 */
function hasTarget(type) {
    return adapters.has(type);
}
exports.hasTarget = hasTarget;
/**
 * Get all registered target types.
 */
function getRegisteredTargets() {
    return Array.from(adapters.keys());
}
exports.getRegisteredTargets = getRegisteredTargets;
//# sourceMappingURL=target-registry.js.map