import { listSpeechProviders } from "./speech-registry.js";
import { resolveSpeechProvider } from "./factory.js";
import { mergeTtsConfigFromAppConfig } from "./merge-config.js";
import { getVoiceProviderMetadata } from "../metadata/registry.js";
import "../metadata/index.js";
//#region src/voice/tts/list-providers.ts
function fallbackMetadata(providerId, aliases) {
	return {
		id: providerId,
		capability: "tts",
		displayName: providerId,
		aliases: [...aliases],
		fields: [
			{
				key: "apiKey",
				label: "API Key",
				type: "password",
				secret: true
			},
			{
				key: "model",
				label: "Model",
				type: "string"
			},
			{
				key: "voice",
				label: "Voice",
				type: "string"
			}
		],
		diagnostics: {
			requiresApiKey: true,
			configPath: `messages.tts.providers.${providerId}`
		}
	};
}
/** List registered speech providers with configured state and UI metadata. */
function listTtsProvidersForApi(config) {
	const ttsConfig = mergeTtsConfigFromAppConfig(config?.messages?.tts);
	return {
		providers: listSpeechProviders().map((plugin) => {
			const metadata = getVoiceProviderMetadata("tts", plugin.id) ?? fallbackMetadata(plugin.id, plugin.aliases ?? []);
			return {
				...metadata,
				aliases: [...metadata.aliases ?? plugin.aliases ?? []],
				configured: resolveSpeechProvider(plugin.id, ttsConfig) !== null
			};
		}),
		active: ttsConfig.provider
	};
}
//#endregion
export { listTtsProvidersForApi };

//# sourceMappingURL=list-providers.js.map