import { OpenAIOpenAIPipelineCodec } from './pipeline/codecs/v2/openai-openai-pipeline.js';
import { AnthropicOpenAIPipelineCodec } from './pipeline/codecs/v2/anthropic-openai-pipeline.js';
import { ResponsesOpenAIPipelineCodec } from './pipeline/codecs/v2/responses-openai-pipeline.js';
export class CodecRegistry {
    factories = new Map();
    instances = new Map();
    constructor(_deps) { }
    register(id, factory) {
        this.factories.set(id, factory);
    }
    async resolve(id) {
        if (this.instances.has(id)) {
            return this.instances.get(id);
        }
        const factory = this.factories.get(id);
        if (!factory) {
            throw new Error(`Unknown conversion codec: ${id}`);
        }
        const instance = await factory();
        await instance.initialize();
        this.instances.set(id, instance);
        return instance;
    }
}
// Default codec factories placeholder. In phase 1 we intentionally do not
// reimplement codecs here; the router will not be switched yet. This file is
// prepared so later phases can register actual codecs.
export function getDefaultCodecFactories() {
    return {
        'openai-openai': () => new OpenAIOpenAIPipelineCodec(),
        'openai-openai-v2': () => new OpenAIOpenAIPipelineCodec(),
        'anthropic-openai': () => new AnthropicOpenAIPipelineCodec(),
        'anthropic-openai-v2': () => new AnthropicOpenAIPipelineCodec(),
        'responses-openai': () => new ResponsesOpenAIPipelineCodec(),
        'responses-openai-v2': () => new ResponsesOpenAIPipelineCodec()
    };
}
