import type { RefObject } from "react";
import type { Node, Edge, OnNodesChange, OnEdgesChange, Connection, IsValidConnection } from "@xyflow/react";
import type { WorkflowGraphModel } from "./workflow-graph-model";
import type { TaskKindDescriptor } from "./types";
import type { LayoutEngine } from "./layout";
/** Selection state for the canvas inspector. */
export interface CanvasSelection {
    readonly type: "node" | "edge";
    readonly id: string;
}
/** Options for {@link useWorkflowCanvas}. */
export interface UseWorkflowCanvasOptions {
    /**
     * Layout engine for the "Auto Layout" action.
     * When provided, this engine is used instead of the default dagre engine.
     * Pass the result of {@link useElkLayoutEngine} for ELK-powered layout.
     * When `null` or `undefined`, dagre is used as the default.
     */
    readonly layoutEngine?: LayoutEngine | null;
}
/** Return value of {@link useWorkflowCanvas}. */
export interface UseWorkflowCanvasReturn {
    readonly nodes: Node[];
    readonly edges: Edge[];
    readonly onNodesChange: OnNodesChange;
    readonly onEdgesChange: OnEdgesChange;
    readonly onConnect: (connection: Connection) => void;
    readonly isValidConnection: IsValidConnection;
    readonly onDrop: (event: React.DragEvent) => void;
    readonly onDragOver: (event: React.DragEvent) => void;
    readonly onNodesDelete: (deleted: Node[]) => void;
    readonly onEdgesDelete: (deleted: Edge[]) => void;
    readonly selection: CanvasSelection | null;
    readonly selectNode: (id: string) => void;
    readonly selectEdge: (id: string) => void;
    readonly clearSelection: () => void;
    readonly autoLayout: () => void;
    readonly undo: () => void;
    readonly redo: () => void;
    readonly canUndo: boolean;
    readonly canRedo: boolean;
    readonly isDirty: boolean;
    readonly graph: WorkflowGraphModel | null;
    readonly error: string | null;
    readonly updateNodeField: (nodeId: string, fieldPath: string, value: unknown) => void;
    readonly renameNode: (nodeId: string, newName: string) => void;
    readonly updateNodeExport: (nodeId: string, exportAs: string | undefined) => void;
    readonly updateNodeFlow: (nodeId: string, thenTarget: string | undefined) => void;
    readonly getNodeDescriptor: (nodeId: string) => TaskKindDescriptor | undefined;
    readonly serializeToYaml: () => string | null;
    readonly updateBranchRouting: (nodeId: string, handleId: string, targetTask: string | undefined) => void;
    readonly migrateBranchHandle: (nodeId: string, oldHandleId: string, newHandleId: string) => void;
    readonly removeBranchEdges: (nodeId: string, handleId: string) => void;
    readonly insertTaskOnEdge: (edgeId: string, kindString: string) => void;
    readonly addSuccessorTask: (sourceNodeId: string, kindString: string) => void;
    readonly duplicateNode: (nodeId: string) => void;
    readonly addNodeAtPosition: (kindString: string, position: {
        x: number;
        y: number;
    }) => void;
    readonly addSwitchCase: (switchNodeId: string, caseName: string, condition: string) => void;
    readonly addForkBranch: (forkNodeId: string, branchName: string) => void;
    readonly addCatchHandler: (tryCatchNodeId: string, errorType: string) => void;
    readonly removeSwitchCase: (switchNodeId: string, caseName: string) => void;
    readonly reorderSwitchCases: (switchNodeId: string, newOrder: readonly string[]) => void;
    readonly removeForkBranch: (forkNodeId: string, branchName: string) => void;
    readonly reorderForkBranches: (forkNodeId: string, newOrder: readonly string[]) => void;
    readonly renameForkBranch: (forkNodeId: string, oldName: string, newName: string) => void;
    readonly setForkCompete: (forkNodeId: string, compete: boolean) => void;
    readonly updateCatchConfig: (tryCatchNodeId: string, updates: {
        as?: string;
        compensate?: boolean;
    }) => void;
    readonly removeCatchBlock: (tryCatchNodeId: string) => void;
    readonly updateForEachConfig: (forEachNodeId: string, updates: Partial<{
        each: string;
        in: string;
        max_parallelism: number;
        batch_size: number;
        on_error: string;
    }>) => void;
    readonly getGraphModel: () => WorkflowGraphModel;
    readonly selectAll: () => void;
    readonly toggleNodeDisabled: (nodeId: string) => void;
    readonly wrapInTryCatch: (nodeId: string) => void;
    readonly copySelection: () => void;
    readonly pasteAtCenter: () => void;
    readonly cutSelection: () => void;
    readonly hasClipboard: boolean;
    readonly duplicateSelection: () => void;
    readonly disableSelection: () => void;
    readonly deleteSelection: () => void;
    readonly getSelectedNodeIds: () => ReadonlySet<string>;
}
/**
 * Orchestrator hook for the workflow canvas editor.
 *
 * Manages the {@link WorkflowGraphModel} through a command/history pipeline
 * (AD-T15-B2-001). Structural mutations (add/delete nodes and edges) go
 * through {@link GraphCommand}s dispatched to the history. React Flow state
 * is derived from the model after each mutation.
 *
 * @param yaml - The workflow YAML to initialize from. Changes trigger re-parse.
 * @param containerRef - Ref to the canvas container for keyboard shortcut scoping.
 * @param options - Optional configuration including a custom layout engine.
 *
 * @since T15 (Visual Canvas Editor)
 */
export declare function useWorkflowCanvas(yaml: string | null, containerRef: RefObject<HTMLDivElement | null>, options?: UseWorkflowCanvasOptions): UseWorkflowCanvasReturn;
//# sourceMappingURL=useWorkflowCanvas.d.ts.map