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

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

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-notifications", labelKey: "nav.shopNotifications" },
      { id: "shop-discover", labelKey: "nav.shopDiscover" },
    ],
  },
  {
    id: "printer",
    labelKey: "nav.printer",
    children: [
      { id: "printer-config", labelKey: "nav.printerSettings" },
      { id: "print-test", labelKey: "nav.printTest" },
    ],
  },
  {
    id: "team",
    labelKey: "nav.team",
    children: [
      { id: "team-custom-roles", labelKey: "nav.customRoles" },
    ],
  },
];

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

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