import { useMemo } from 'react' import { useInitiativeOperations } from '../context/InitiativeOperationsContext.jsx' import { resolveSteeringComposition } from './resolveSteeringComposition.js' /** * Hook: baut Composition-Input aus InitiativeOperationsContext. * @param {string} surfaceKey * @param {Record} [options] */ export function useSteeringComposition(surfaceKey, options = {}) { const ops = useInitiativeOperations() const { filterContext = options.filterContext || {}, scope = 'initiative', } = options const opsContext = useMemo( () => ({ initiativeId: ops.initiativeId, actions: ops.actions, steeringSnapshotLoading: ops.steeringSnapshotLoading, steeringSnapshotError: ops.steeringSnapshotError, steeringMethods: ops.steeringMethods, handleMethodChange: ops.handleMethodChange, methodBusy: ops.methodBusy, formBusy: ops.formBusy, onAcceptBacklogProposal: options.onAcceptBacklogProposal, }), [ ops.initiativeId, ops.actions, ops.steeringSnapshotLoading, ops.steeringSnapshotError, ops.steeringMethods, ops.handleMethodChange, ops.methodBusy, ops.formBusy, options.onAcceptBacklogProposal, ], ) return useMemo( () => resolveSteeringComposition({ surfaceKey, scope, steeringElements: ops.steeringElements, operatingContext: ops.operatingContext, steeringSnapshot: ops.steeringSnapshot, capabilities: ops.capabilities, filterContext, opsContext, }), [ surfaceKey, scope, ops.steeringElements, ops.operatingContext, ops.steeringSnapshot, ops.capabilities, filterContext, opsContext, ], ) }