/**
 * Application Entry Point
 * Generated by Dazzle Native Runtime
 */

import { createApp } from '@dnr/app.js';
import uiSpec from './ui-spec.json';

// Initialize app on DOM ready
document.addEventListener('DOMContentLoaded', () => {
  const app = createApp(uiSpec);

  // Get the app root element
  // Shell rendering (nav, header, footer) is handled by createShell() in app.js
  const appRoot = document.getElementById('app') || document.body;
  appRoot.classList.add('dz-app');

  // Mount default workspace - shell creates the layout structure
  const defaultWorkspace = uiSpec.default_workspace || uiSpec.defaultWorkspace ||
                          (uiSpec.workspaces?.[0]?.name);

  if (defaultWorkspace) {
    app.mount(appRoot, defaultWorkspace);
  }

  // Export app for debugging
  window.dnrApp = app;
});
