export type NodeToolbarKey =
  | "back"
  | "forward"
  | "painter"
  | "siblingNode"
  | "childNode"
  | "deleteNode"
  | "image"
  | "icon"
  | "link"
  | "note"
  | "tag"
  | "summary"
  | "associativeLine"
  | "formula"
  | "attachment"
  | "outerFrame"
  | "annotation"
  | "ai";

export type FileToolbarKey =
  | "directory"
  | "newFile"
  | "openFile"
  | "import"
  | "saveAs"
  | "deleteFile"
  | "exportMenu";

type ToolbarMeta = {
  label: string;
  iconClass: string;
};

type ToolbarConfig = Record<NodeToolbarKey, ToolbarMeta>;
type FileToolbarConfig = Record<FileToolbarKey, ToolbarMeta>;

// 按官方 Toolbar.vue 的顺序定义节点工具按钮
export const nodeToolbarOrder: NodeToolbarKey[] = [
  "back",
  "forward",
  "painter",
  "siblingNode",
  "childNode",
  "deleteNode",
  "image",
  "icon",
  "link",
  "note",
  "tag",
  "summary",
  "associativeLine",
  "formula",
  "attachment",
  "outerFrame",
  // 官方还有注释/AI 占位，这里先留钩子
  "annotation",
  "ai",
];

export const nodeToolbarMeta: ToolbarConfig = {
  back: { label: "回退", iconClass: "iconhoutui-shi" },
  forward: { label: "前进", iconClass: "iconqianjin1" },
  painter: { label: "格式刷", iconClass: "iconjiedian" },
  siblingNode: { label: "同级节点", iconClass: "iconjiedian" },
  childNode: { label: "子节点", iconClass: "icontianjiazijiedian" },
  deleteNode: { label: "删除节点", iconClass: "iconshanchu" },
  image: { label: "图片", iconClass: "iconimage" },
  icon: { label: "图标", iconClass: "iconxiaolian" },
  link: { label: "超链接", iconClass: "iconchaolianjie" },
  note: { label: "备注", iconClass: "iconflow-Mark" },
  tag: { label: "标签", iconClass: "iconbiaoqian" },
  summary: { label: "概要", iconClass: "icongaikuozonglan" },
  associativeLine: { label: "关联线", iconClass: "iconlianjiexian" },
  formula: { label: "公式", iconClass: "icongongshi" },
  attachment: { label: "附件", iconClass: "iconfujian" },
  outerFrame: { label: "外框", iconClass: "iconwaikuang" },
  annotation: { label: "标注", iconClass: "iconhighlight" },
  ai: { label: "AI", iconClass: "iconstar" },
};

export const fileToolbarOrder: FileToolbarKey[] = [
  "directory",
  "newFile",
  "openFile",
  "import",
  "saveAs",
  "deleteFile",
  "exportMenu",
];

export const fileToolbarMeta: FileToolbarConfig = {
  directory: { label: "目录", iconClass: "iconwenjian" },
  newFile: { label: "新建", iconClass: "iconxinjian" },
  openFile: { label: "打开", iconClass: "icondakai" },
  import: { label: "导入", iconClass: "icondaoru" },
  saveAs: { label: "另存为", iconClass: "iconlingcunwei" },
  deleteFile: { label: "删除", iconClass: "iconshanchu" },
  exportMenu: { label: "导出", iconClass: "iconexport" },
};
