import { e as IntakeAnswers, b as IntakeGraph, I as IntakeAnswerValue } from './model-C8U0HZxL.js';

/**
 * Pure completion-state helpers for an intake payload — the small algebra over
 * the JSON blob the store persists. No I/O: the store reads/writes the row;
 * these functions only build and judge the payload shape, so the same logic
 * runs in the UI, the handlers, and the DB layer without divergence.
 *
 * A payload is `{ graphId, answers, completedAt? }`. It carries the answers
 * and the id of the graph they were collected against, so a later graph
 * revision can detect a stale payload (`graphId` mismatch) rather than
 * silently mixing answers from two question sets.
 */

/** The persisted JSON for one intake (the `payload` column). */
interface IntakePayload {
    /** The graph id the answers were collected against — guards stale schemas. */
    graphId: string;
    answers: IntakeAnswers;
    /** ISO-8601 instant the intake was completed, or undefined while in progress. */
    completedAt?: string;
}
/** An empty payload for a fresh intake against `graph`. */
declare function emptyPayload(graph: IntakeGraph): IntakePayload;
/** A copy of `payload` with one answer set (does not mutate the input). */
declare function withAnswer(payload: IntakePayload, questionId: string, value: IntakeAnswerValue): IntakePayload;
/**
 * True when the payload's answers complete the graph AND the payload was
 * collected against THIS graph. A `graphId` mismatch is never "complete" —
 * the answers belong to a different question set and must be re-collected.
 */
declare function payloadComplete(graph: IntakeGraph, payload: IntakePayload): boolean;
/** True when the payload was collected against a DIFFERENT graph revision. */
declare function payloadIsStale(graph: IntakeGraph, payload: IntakePayload): boolean;
/**
 * Stamp the payload complete at `at` (default now). Returns a copy; pure. The
 * caller has already checked `payloadComplete` — this only records the instant.
 */
declare function markComplete(payload: IntakePayload, at?: Date): IntakePayload;

export { type IntakePayload as I, payloadIsStale as a, emptyPayload as e, markComplete as m, payloadComplete as p, withAnswer as w };
