/**
 * Wiki generation checkpoint store.
 *
 * Defines an interface for persisting per-step generation results so that
 * wiki generation can resume from where it left off after a failure.
 *
 * The UI package provides a PostgreSQL-backed implementation.
 */

import type { WikiNavigationNode, WikiPage } from "../types/wiki-model";

export interface CachedStepResult {
  pages: WikiPage[];
  supplementalNav?: WikiNavigationNode[];
  warning: string | null;
}

/**
 * Abstraction over the persistence layer used by the wiki generator
 * to checkpoint completed generation steps.
 */
export interface WikiCheckpointStore {
  /** Return a previously cached result for the given step, or null if not cached. */
  get(stepKey: string): Promise<CachedStepResult | null>;

  /** Persist the result of a completed generation step. */
  set(stepKey: string, stepType: string, result: CachedStepResult): Promise<void>;

  /** Clear all cached steps (used for force-regeneration). */
  clear(): Promise<void>;
}
