"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpecRegistry = void 0;
class SpecRegistry {
    constructor() {
        this.factories = new Map();
    }
    register(specId, factory) {
        if (!specId) {
            throw new Error("specId is required");
        }
        if (this.factories.has(specId)) {
            throw new Error(`Spec already registered: "${specId}"`);
        }
        this.factories.set(specId, factory);
    }
    create(specId) {
        const factory = this.factories.get(specId);
        if (!factory) {
            throw new Error(`Spec not registered: "${specId}"`);
        }
        return factory();
    }
    has(specId) {
        return this.factories.has(specId);
    }
    list() {
        return Array.from(this.factories.keys()).sort();
    }
}
exports.SpecRegistry = SpecRegistry;
//# sourceMappingURL=spec-registry.js.map