export function joinNotes(notes) {
    return notes.length > 0 ? notes.join("; ") : null;
}
export function buildWhisperResult({ attemptedProviders, notes, outcome, metadata, includeProviderOnFailure = false, }) {
    if (outcome.text) {
        return {
            text: outcome.text,
            source: "whisper",
            segments: outcome.segments ?? null,
            attemptedProviders,
            notes: joinNotes(notes),
            metadata: {
                ...metadata,
                transcriptionProvider: outcome.provider,
            },
        };
    }
    const failureMetadata = includeProviderOnFailure && outcome.provider
        ? { ...metadata, transcriptionProvider: outcome.provider }
        : metadata;
    return {
        text: null,
        source: null,
        attemptedProviders,
        notes: outcome.error?.message ?? null,
        metadata: failureMetadata,
    };
}
//# sourceMappingURL=results.js.map