import { DEFAULT_TEST_ID } from "./constants.js";
import { Fixture, JournalEntry } from "./types.js";

//#region src/journal.d.ts
interface JournalOptions {
  /**
   * Maximum number of entries to retain. When exceeded, oldest entries are
   * dropped FIFO. Set to 0 (or omit) for unbounded retention (the historical
   * default — suitable for short-lived test runs only). Negative values are
   * rejected at the CLI parse layer; programmatically they are treated as 0
   * (unbounded) for back-compat.
   *
   * Long-running servers (e.g. mock proxies in CI/demo environments) should
   * always set a finite cap: every request appends an entry holding the
   * request body + headers + fixture reference, and without a cap the
   * journal grows until the process OOMs.
   */
  maxEntries?: number;
  /**
   * Maximum number of unique testIds retained in the fixture match-count
   * map (`fixtureMatchCountsByTestId`). When exceeded, the oldest testId
   * (by first-insertion order) is evicted FIFO. Set to 0 (or omit) for
   * unbounded retention. Negative values are rejected at the CLI parse
   * layer; programmatically they are treated as 0 (unbounded) for
   * back-compat. Without a cap this map can grow over time in long-running
   * servers that see many unique testIds.
   */
  fixtureCountsMaxTestIds?: number;
}
declare class Journal {
  private entries;
  private readonly fixtureMatchCountsByTestId;
  private readonly maxEntries;
  private readonly fixtureCountsMaxTestIds;
  constructor(options?: JournalOptions);
  /** Backwards-compatible accessor — returns the default (no testId) count map. */
  get fixtureMatchCounts(): Map<Fixture, number>;
  add(entry: Omit<JournalEntry, "id" | "timestamp">): JournalEntry;
  getAll(opts?: {
    limit?: number;
  }): JournalEntry[];
  getLast(): JournalEntry | null;
  findByFixture(fixture: Fixture): JournalEntry[];
  /**
   * READ-ONLY accessor. Returns the existing count map for `testId`, or an
   * empty transient Map if none exists. Does NOT insert into the cache and
   * does NOT trigger FIFO eviction — callers may read freely without
   * perturbing cache state. For the write path, see
   * `getOrCreateFixtureMatchCountsForTest`.
   */
  getFixtureMatchCountsForTest(testId: string): Map<Fixture, number>;
  /**
   * WRITE path: get the count map for `testId`, inserting a fresh empty Map
   * if missing and running FIFO eviction when the testId cap is exceeded.
   * Only callers that intend to mutate the map (e.g. incrementing a count)
   * should use this.
   */
  private getOrCreateFixtureMatchCountsForTest;
  getFixtureMatchCount(fixture: Fixture, testId?: string): number;
  incrementFixtureMatchCount(fixture: Fixture, allFixtures?: readonly Fixture[], testId?: string): void;
  clearMatchCounts(testId?: string): void;
  /**
   * Clear ONLY the request journal entries, preserving fixture match-counts.
   * Match-counts are fixture-matching/sequencing state, not journal data, so
   * clearing the journal must not silently rewind sequenced fixtures. Used by
   * `POST /__aimock/reset/journal`. For a full reset (entries + match-counts),
   * use `clear()` instead.
   */
  clearEntries(): void;
  clear(): void;
  get size(): number;
}
//# sourceMappingURL=journal.d.ts.map
//#endregion
export { Journal };
//# sourceMappingURL=journal.d.ts.map