import { OnModuleInit, OnModuleDestroy } from '@nestjs/common';
import { IObservability } from '../observability.protocol.js';
import { ObservabilityModuleOptions } from '../observability.module.js';
import '../../jobs/job-run-service.protocol.js';
import '../../../../job-orchestrator.protocol-ZuJ3ow-O.js';
import '../../events/event-bus.protocol.js';
import '../../../types/drizzle.js';
import 'drizzle-orm/node-postgres';
import '../../jobs/job-orchestration.schema.js';
import 'drizzle-orm/pg-core';
import 'drizzle-orm';
import '../../events/event-registry.js';
import '../../events/event-read.protocol.js';
import '../../bridge/bridge.protocol.js';
import '../../bridge/bridge-delivery.schema.js';
import '../../integration/integration-run-recorder.protocol.js';
import '../../integration/integration-field-diff.protocol.js';
import 'zod';
import '../../integration/integration-cursor-store.protocol.js';

/**
 * BridgeMetricsReporter — internal consumer of `IObservability`
 * (ADR-025, OBS-6).
 *
 * Periodically samples `getBridgeDeliveryHistogram` from the observability
 * facade and emits one log line per tick. Auto-registered by
 * `ObservabilityModule.forRoot()` when
 * `options.reporters.bridgeMetrics.enabled === true`. Consumers configure
 * via options; they never import this class. Not exported from the
 * module's `exports` array — internal.
 *
 * # Invariants (enforced by skill + ADR-025)
 *
 *   - Injects ONLY `OBSERVABILITY` + `OBSERVABILITY_MODULE_OPTIONS`. Never
 *     `BRIDGE_DELIVERY_REPO` or any other sibling token. Reporters are
 *     consumers of the composed facade, not parallel composers.
 *   - Never reaches into sibling tables or extends `IObservability`.
 *   - Errors isolated per-tick (logged, never rethrown) so a transient
 *     sibling failure does not kill the interval.
 *   - `tenantId` passes VERBATIM to the facade — observability owns tenant
 *     semantics, reporters don't re-implement them.
 *
 * # Lifecycle
 *
 *   - `onModuleInit` — eager first-tick, then `setInterval`. Handle is
 *     `.unref()`-ed when supported so the loop never blocks node shutdown.
 *   - `onModuleDestroy` — `clearInterval` + null the handle. Idempotent.
 *
 * No `@nestjs/schedule` dependency — raw `setInterval` keeps the runtime
 * footprint minimal and avoids pulling a decorator framework in for a
 * single loop.
 */

declare class BridgeMetricsReporter implements OnModuleInit, OnModuleDestroy {
    private readonly observability;
    private readonly logger;
    private handle;
    private readonly config;
    constructor(observability: IObservability, options: ObservabilityModuleOptions);
    onModuleInit(): void;
    onModuleDestroy(): void;
    /**
     * Single sample. Public so tests and future ops tooling can trigger a
     * sample on demand without waiting for the interval. Errors are caught
     * and logged here — never rethrown — so a transient sibling failure
     * does not kill subsequent ticks.
     */
    runOnce(): Promise<void>;
}

export { BridgeMetricsReporter };
