export const DISABLED_OBSERVABILITY_CONFIG = {
    enabled: false,
    monitor: false,
    sessionLogExporter: false,
    usageEventsPhase: false,
};
export function normalizeObservabilityConfig(raw) {
    if (!raw) {
        return undefined;
    }
    const config = {
        enabled: raw.enabled,
        monitor: raw.monitor,
        sessionLogExporter: raw.session_log_exporter,
        usageEventsPhase: raw.usage_events_phase,
    };
    return hasObservabilityField(config) ? config : undefined;
}
export function denormalizeObservabilityConfig(config) {
    if (!config) {
        return undefined;
    }
    const raw = {};
    if (config.enabled !== undefined)
        raw.enabled = config.enabled;
    if (config.monitor !== undefined)
        raw.monitor = config.monitor;
    if (config.sessionLogExporter !== undefined)
        raw.session_log_exporter = config.sessionLogExporter;
    if (config.usageEventsPhase !== undefined)
        raw.usage_events_phase = config.usageEventsPhase;
    return Object.keys(raw).length > 0 ? raw : undefined;
}
export function resolveObservabilityConfig(project, global) {
    return {
        enabled: project?.enabled ?? global?.enabled ?? DISABLED_OBSERVABILITY_CONFIG.enabled,
        monitor: project?.monitor ?? global?.monitor ?? DISABLED_OBSERVABILITY_CONFIG.monitor,
        sessionLogExporter: project?.sessionLogExporter
            ?? global?.sessionLogExporter
            ?? DISABLED_OBSERVABILITY_CONFIG.sessionLogExporter,
        usageEventsPhase: project?.usageEventsPhase
            ?? global?.usageEventsPhase
            ?? DISABLED_OBSERVABILITY_CONFIG.usageEventsPhase,
    };
}
function hasObservabilityField(config) {
    return config.enabled !== undefined
        || config.monitor !== undefined
        || config.sessionLogExporter !== undefined
        || config.usageEventsPhase !== undefined;
}
//# sourceMappingURL=observabilityConfig.js.map