import { buildRoutingState } from './route-state.js';
import { selectRoutingTarget } from './route-selection.js';
import { finalizeRoutingDecision } from './route-finalize.js';
export function routeRequest(engine, request, metadata) {
    const routingStateResult = buildRoutingState(engine, request, metadata);
    const selectionResult = selectRoutingTarget(engine, request, metadata, routingStateResult.routingState, routingStateResult.stateKey);
    return finalizeRoutingDecision(engine, metadata, selectionResult.routingState, routingStateResult.metadataInstructions, routingStateResult.instructions, selectionResult);
}
