import { DetectionConfig } from './detection-config.schema.js';
import { IChangeSource } from './integration-change-source.protocol.js';
import { ChangeMiddleware } from './integration-middleware.protocol.js';
import { PollFetchCallback } from './poll-change-source.js';
import { WebhookFetchCallback } from './webhook-change-source.js';
import 'zod';

/**
 * Integration subsystem — `buildChangeSource()` runtime factory (#250, ADR-033.1 b).
 *
 * Mode-dispatching constructor for `IChangeSource<T>`. Codegen-emitted
 * provider modules call this from `useFactory` once they've resolved the
 * provider-keyed `fetches[provider]` callback and parsed the per-entity
 * `DetectionConfig`. Switching is on `cfg.mode` so the option-bag shape
 * difference between primitives (`adapter` vs. `queue`) stays internal —
 * consumers pass one fetch callback regardless of mode.
 */

declare function buildChangeSource<T>(cfg: DetectionConfig, fetch: PollFetchCallback<T> | WebhookFetchCallback<T>, middlewares?: ReadonlyArray<ChangeMiddleware<T>>): IChangeSource<T>;

export { buildChangeSource };
