export type SettingsGroupId = "shop" | "printer";

export type SettingsLeafId =
  | "shop-general"
  | "shop-appearance"
  | "shop-discover"
  | "printer-config"
  | "print-test";

export type SettingsNavGroup = {
  id: SettingsGroupId;
  labelKey: string;
  children: { id: SettingsLeafId; labelKey: string }[];
};

export const SETTINGS_NAV: SettingsNavGroup[] = [
  {
    id: "shop",
    labelKey: "nav.shop",
    children: [
      { id: "shop-general", labelKey: "nav.shopGeneral" },
      { id: "shop-appearance", labelKey: "nav.shopAppearance" },
      { id: "shop-discover", labelKey: "nav.shopDiscover" },
    ],
  },
  {
    id: "printer",
    labelKey: "nav.printer",
    children: [
      { id: "printer-config", labelKey: "nav.printerSettings" },
      { id: "print-test", labelKey: "nav.printTest" },
    ],
  },
];

export const DEFAULT_SETTINGS_LEAF: SettingsLeafId = "shop-general";

export function groupForLeaf(leaf: SettingsLeafId): SettingsGroupId {
  return leaf === "printer-config" || leaf === "print-test" ? "printer" : "shop";
}
