import assert from "node:assert/strict";

import {
  INI_PANEL_ENTRIES,
  getIniPanelEntryByHref,
  getIniPanelEntryManifest,
} from "../../../runtime/ui/ini-panel/entry-manifest.js";

assert.deepEqual(INI_PANEL_ENTRIES, [
  {
    id: "edit-run",
    title: "Open edit and run panel",
    href: "./index.html",
  },
  {
    id: "control-view",
    title: "Open read-only control view",
    href: "./control-page.html",
  },
  {
    id: "workflow-overview",
    title: "Open shell handoff overview",
    href: "./workflow-overview.html",
  },
]);

const manifest = getIniPanelEntryManifest();
assert.deepEqual(manifest, INI_PANEL_ENTRIES);
assert.notStrictEqual(manifest, INI_PANEL_ENTRIES);
assert.notStrictEqual(manifest[0], INI_PANEL_ENTRIES[0]);

assert.deepEqual(getIniPanelEntryByHref("./index.html"), INI_PANEL_ENTRIES[0]);
assert.deepEqual(getIniPanelEntryByHref("./control-page.html"), INI_PANEL_ENTRIES[1]);
assert.deepEqual(getIniPanelEntryByHref("./workflow-overview.html"), INI_PANEL_ENTRIES[2]);
assert.equal(getIniPanelEntryByHref("./missing.html"), null);

manifest[0].title = "changed";
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");

console.log("ini_panel_entry_manifest_node_smoke=ok");
