/** * This Source Code is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) Infonomic Company Limited */ import type { CollectionDefinition, WorkflowConfig, WorkflowStatus } from '../@types/collection-types.js'; /** * Resolve the effective workflow for a collection. * Falls back to `DEFAULT_WORKFLOW` when the collection omits its own. */ export declare function getWorkflow(collection: CollectionDefinition): WorkflowConfig; /** * Return the ordered status list for a collection. */ export declare function getWorkflowStatuses(collection: CollectionDefinition): WorkflowStatus[]; /** * Return the default status name for new documents in a collection. */ export declare function getDefaultStatus(collection: CollectionDefinition): string; export interface TransitionResult { valid: boolean; reason?: string; } /** * Validate a status transition within a sequential workflow. * * Allowed moves: * - Forward one step (e.g. draft → needs_review) * - Backward one step (e.g. needs_review → draft) * - Reset to first status from any position (e.g. published → draft) * - Same status (no-op, always valid) */ export declare function validateStatusTransition(workflow: WorkflowConfig, currentStatus: string, nextStatus: string): TransitionResult; /** * Return the status names that are valid targets from the given current status. */ export declare function getAvailableTransitions(workflow: WorkflowConfig, currentStatus: string): string[];