/**
 * Facade for commit DAG traversal operations.
 *
 * Composes DagTraversal, DagPathFinding, and DagTopology services
 * into a single backward-compatible API surface. All public methods
 * delegate to the appropriate sub-service.
 *
 * @module domain/services/dag/CommitDagTraversalService
 */
import nullLogger from "../../utils/nullLogger.js";
import DagTraversal from "./DagTraversal.js";
import DagPathFinding from "./DagPathFinding.js";
import DagTopology from "./DagTopology.js";
import TraversalError from "../../errors/TraversalError.js";
export default class CommitDagTraversalService {
    _traversal;
    _pathFinding;
    _topology;
    constructor(deps) {
        if (deps.indexReader === null || deps.indexReader === undefined) {
            throw new TraversalError('CommitDagTraversalService requires an indexReader', { code: 'E_DAG_TRAVERSAL_NO_INDEX' });
        }
        const logger = deps.logger ?? nullLogger;
        this._traversal = new DagTraversal({ indexReader: deps.indexReader, logger });
        this._pathFinding = new DagPathFinding({ indexReader: deps.indexReader, logger });
        this._topology = new DagTopology({ indexReader: deps.indexReader, logger, traversal: this._traversal });
        this._traversal._setPathFinder(this._pathFinding);
    }
    // -- Traversal (delegated to DagTraversal) ----------------------------------
    bfs(opts) {
        return this._traversal.bfs(opts);
    }
    dfs(opts) {
        return this._traversal.dfs(opts);
    }
    ancestors(opts) {
        return this._traversal.ancestors(opts);
    }
    descendants(opts) {
        return this._traversal.descendants(opts);
    }
    isReachable(opts) {
        return this._traversal.isReachable(opts);
    }
    // -- Path finding (delegated to DagPathFinding) -----------------------------
    findPath(opts) {
        return this._pathFinding.findPath(opts);
    }
    shortestPath(opts) {
        return this._pathFinding.shortestPath(opts);
    }
    weightedShortestPath(opts) {
        return this._pathFinding.weightedShortestPath(opts);
    }
    aStarSearch(opts) {
        return this._pathFinding.aStarSearch(opts);
    }
    bidirectionalAStar(opts) {
        return this._pathFinding.bidirectionalAStar(opts);
    }
    // -- Topology (delegated to DagTopology) ------------------------------------
    commonAncestors(opts) {
        return this._topology.commonAncestors(opts);
    }
    topologicalSort(opts) {
        return this._topology.topologicalSort(opts);
    }
}
