/**
 * Workflow State Database Operations
 *
 * Provides operations for the workflow state machine that tracks document
 * lifecycle states. Enforces valid state transitions to prevent invalid
 * workflow progression.
 *
 * State machine:
 *   '' -> draft -> submitted -> in_review -> approved -> executed -> archived
 *                                         \-> changes_requested -> submitted
 *                                         \-> rejected -> archived
 *                             approved -> expired (auto, past due_date)
 *
 * CRITICAL: NEVER use console.log() - stdout is reserved for JSON-RPC protocol.
 *
 * @module database/workflow-operations
 */
import type Database from 'better-sqlite3';
export interface WorkflowStateRow {
    id: string;
    document_id: string;
    state: string;
    assigned_to: string | null;
    assigned_by: string | null;
    reason: string | null;
    due_date: string | null;
    completed_at: string | null;
    created_at: string;
    metadata_json: string | null;
}
export interface CreateWorkflowStateParams {
    document_id: string;
    state: string;
    assigned_to?: string | null;
    assigned_by?: string | null;
    reason?: string | null;
    due_date?: string | null;
    metadata?: Record<string, unknown> | null;
}
export interface WorkflowQueueFilters {
    assigned_to?: string;
    state?: string;
    due_before?: string;
    limit?: number;
    offset?: number;
}
/**
 * Map of current state -> allowed next states.
 * Empty string key represents "no existing state" (initial transition).
 */
export declare const VALID_TRANSITIONS: Record<string, string[]>;
/**
 * Get the most recent workflow state for a document.
 *
 * @param conn - Database connection
 * @param documentId - Document ID
 * @returns Latest workflow state row or null if no workflow history
 */
export declare function getLatestWorkflowState(conn: Database.Database, documentId: string): WorkflowStateRow | null;
/**
 * Create a new workflow state for a document.
 *
 * Enforces valid state transitions. If the document has no prior workflow
 * state, only 'draft' is allowed. Otherwise the new state must be in the
 * VALID_TRANSITIONS map for the current state.
 *
 * @param conn - Database connection
 * @param params - Workflow state creation parameters
 * @returns The created workflow state row
 * @throws Error if document not found or transition is invalid
 */
export declare function createWorkflowState(conn: Database.Database, params: CreateWorkflowStateParams): WorkflowStateRow;
/**
 * List documents pending review with optional filters.
 *
 * Finds the latest workflow state per document and filters by the given
 * criteria. Useful for building reviewer queues.
 *
 * @param conn - Database connection
 * @param filters - Optional query filters
 * @returns Paginated workflow states and total count
 */
export declare function listWorkflowQueue(conn: Database.Database, filters: WorkflowQueueFilters): {
    items: WorkflowStateRow[];
    total: number;
};
/**
 * Get the full workflow history for a document.
 *
 * Returns all workflow state rows ordered by creation time (oldest first),
 * showing the complete state progression.
 *
 * @param conn - Database connection
 * @param documentId - Document ID
 * @returns Array of workflow state rows
 */
export declare function getWorkflowHistory(conn: Database.Database, documentId: string): WorkflowStateRow[];
//# sourceMappingURL=workflow-operations.d.ts.map