import { PrimariaShell } from "./UI/components/primaria-shell/primaria-shell";
import { shellApi } from "./api/api";
import { EcapContext } from "./api/context-manager/context-manager";
import { useFeatures } from "./features/bootstrapper";
import { useLocalization } from "./locales";
import { useUI } from "./UI/bootstrapper";

export const initializeShell = (hostAppElement: HTMLElement, ecapContext?: EcapContext) => {
  // Initialize the context manager with ECAP parameters
  if (ecapContext) {
    (shellApi.contextManager as any).initializeContext(ecapContext);
  }

  useLocalization(shellApi);
  useUI();
  useFeatures(shellApi);
  const shell = new PrimariaShell();
  hostAppElement.appendChild(shell as any);
};
