import type { AdapterResult } from "./schema";

export interface Adapter {
  readonly id: string;
  readonly interval: number; // ms
  /**
   * Returns current items keyed by stable id. Unscoped items form an adapter-wide
   * snapshot. Scoped items resolve by omission only when their reconciliation scope
   * is listed in completeScopes. Throw to retain all previously known state.
   */
  poll(): Promise<AdapterResult>;
}

export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
