/**
 * Dashboard-view body composer for ReactAppStarter (Phase 3)
 *
 * Thin wrapper around walkPattern('dashboard-view'). The pattern
 * registry + section resolvers (metric-cards, charts-placeholder,
 * recent-items) decide what a dashboard view looks like; this
 * composer just emits the resulting tree to JSX source.
 */

import { walkPattern } from '@specverse/runtime/views/core';
import type { EmitContext } from './view-emitter.js';
import { emitJsxSource } from './emit-jsx-source.js';

export function composeDashboardBody(context: EmitContext): string {
  const imports = new Set<string>();
  const nodes = walkPattern('dashboard-view', {
    model: context.model,
    modelSchemas: context.modelSchemas as any,
    view: context.view,
  });
  return emitJsxSource(nodes, { imports, indent: 6 });
}
