import { type ClosingChecklist } from './schemas.js';
import { type ChecklistPatchEnvelope } from './patch-schemas.js';
import { type ChecklistPatchValidationDiagnostic, type ChecklistPatchValidationStore, type ResolvedChecklistPatchOperation } from './patch-validator.js';
export interface ChecklistAppliedPatchRecord {
    checklist_id: string;
    patch_id: string;
    patch_hash: string;
    applied_at_ms: number;
    revision_before: number;
    revision_after: number;
    patch: ChecklistPatchEnvelope;
}
export interface ChecklistAppliedPatchStore {
    get(checklistId: string, patchId: string): Promise<ChecklistAppliedPatchRecord | null>;
    set(record: ChecklistAppliedPatchRecord): Promise<void>;
}
export interface ChecklistProposedPatchRecord {
    checklist_id: string;
    patch_id: string;
    patch_hash: string;
    proposed_at_ms: number;
    expected_revision: number;
    validation_id: string;
    resolved_operations: ResolvedChecklistPatchOperation[];
}
export interface ChecklistProposedPatchStore {
    get(checklistId: string, patchId: string): Promise<ChecklistProposedPatchRecord | null>;
    set(record: ChecklistProposedPatchRecord): Promise<void>;
}
export declare function setChecklistAppliedPatchStore(store: ChecklistAppliedPatchStore | null): void;
export declare function getChecklistAppliedPatchStore(): ChecklistAppliedPatchStore;
export declare function setChecklistProposedPatchStore(store: ChecklistProposedPatchStore | null): void;
export declare function getChecklistProposedPatchStore(): ChecklistProposedPatchStore;
export type ChecklistPatchApplyErrorCode = 'CHECKLIST_SCHEMA_INVALID' | 'APPLY_REQUEST_SCHEMA_INVALID' | 'VALIDATION_REQUIRED' | 'VALIDATION_MISMATCH' | 'REVISION_CONFLICT' | 'PATCH_ID_CONFLICT' | 'APPLY_OPERATION_FAILED' | 'POST_PATCH_SCHEMA_INVALID';
export interface ChecklistPatchApplyFailure {
    ok: false;
    error_code: ChecklistPatchApplyErrorCode;
    message: string;
    diagnostics: ChecklistPatchValidationDiagnostic[];
}
export interface ChecklistPatchApplySuccess {
    ok: true;
    checklist: ClosingChecklist;
    previous_revision: number;
    new_revision: number;
    patch_id: string;
    patch_hash: string;
    idempotent_replay: boolean;
    mode: 'APPLY' | 'PROPOSED';
    applied: boolean;
    resolved_operations: ResolvedChecklistPatchOperation[];
}
export type ChecklistPatchApplyResult = ChecklistPatchApplySuccess | ChecklistPatchApplyFailure;
export interface ApplyChecklistPatchInput {
    checklist_id: string;
    checklist: unknown;
    current_revision: number;
    request: unknown;
    now_ms?: number;
    validation_store?: ChecklistPatchValidationStore;
    applied_patch_store?: ChecklistAppliedPatchStore;
    proposed_patch_store?: ChecklistProposedPatchStore;
}
export declare function applyChecklistPatch(input: ApplyChecklistPatchInput): Promise<ChecklistPatchApplyResult>;
//# sourceMappingURL=patch-apply.d.ts.map