import { mergeProviderOptions, normalizeProviderOptions } from './providerOptions.js';
import { normalizeProviderBlockOptions } from './providerBlockOptions.js';
export function normalizeConfigProviderReferenceDetailed(provider, model, providerOptions) {
    if (typeof provider === 'string' || provider === undefined) {
        return {
            provider,
            model,
            providerOptions: normalizeProviderOptions(providerOptions),
            providerSpecified: provider !== undefined,
        };
    }
    return {
        provider: provider.type,
        model: provider.model ?? model,
        providerOptions: mergeProviderOptions(normalizeProviderBlockOptions(provider), normalizeProviderOptions(providerOptions)),
        providerSpecified: true,
    };
}
export function normalizeConfigProviderReference(provider, model, providerOptions) {
    const normalized = normalizeConfigProviderReferenceDetailed(provider, model, providerOptions);
    return {
        provider: normalized.provider,
        model: normalized.model,
        providerOptions: normalized.providerOptions,
    };
}
//# sourceMappingURL=providerReference.js.map