import type { ToolId } from '../core/store';

export interface ToolMeta {
  id: ToolId;
  label: string;
  short?: string; // compact label for the toolbar
  icon: string;
  hotkey?: string;
  group: number; // for toolbar dividers
  groupName: string; // shown as the group's "tool type" label
  cursor?: string;
}

export const TOOLS: ToolMeta[] = [
  { id: 'select', label: 'Select', icon: 'cursor', hotkey: 'v', group: 0, groupName: 'Basics', cursor: 'default' },
  { id: 'text', label: 'Text', icon: 'text', hotkey: 't', group: 0, groupName: 'Basics', cursor: 'text' },
  { id: 'draw', label: 'Draw', icon: 'pen', hotkey: 'p', group: 0, groupName: 'Basics', cursor: 'crosshair' },
  // native content editing (mupdf engine) — edits the real PDF, not an overlay
  { id: 'edit-text', label: 'Edit text', short: 'Edit', icon: 'editText', hotkey: 'e', group: 1, groupName: 'Edit content', cursor: 'text' },
  { id: 'edit-image', label: 'Edit image', short: 'Image', icon: 'editImage', hotkey: 'i', group: 1, groupName: 'Edit content', cursor: 'default' },
  { id: 'redact', label: 'Redact', icon: 'redact', hotkey: 'x', group: 1, groupName: 'Edit content', cursor: 'crosshair' },
  { id: 'rect', label: 'Rectangle', short: 'Rect', icon: 'rect', hotkey: 'r', group: 2, groupName: 'Shapes', cursor: 'crosshair' },
  { id: 'ellipse', label: 'Ellipse', icon: 'ellipse', hotkey: 'o', group: 2, groupName: 'Shapes', cursor: 'crosshair' },
  { id: 'line', label: 'Line', icon: 'line', hotkey: 'l', group: 2, groupName: 'Shapes', cursor: 'crosshair' },
  { id: 'arrow', label: 'Arrow', icon: 'arrow', hotkey: 'a', group: 2, groupName: 'Shapes', cursor: 'crosshair' },
  { id: 'highlight', label: 'Highlight', short: 'Highlight', icon: 'highlight', hotkey: 'h', group: 3, groupName: 'Markup', cursor: 'crosshair' },
  { id: 'underline', label: 'Underline', icon: 'underline', group: 3, groupName: 'Markup', cursor: 'crosshair' },
  { id: 'strike', label: 'Strikethrough', short: 'Strike', icon: 'strike', group: 3, groupName: 'Markup', cursor: 'crosshair' },
  { id: 'note', label: 'Sticky note', short: 'Note', icon: 'note', hotkey: 'n', group: 3, groupName: 'Markup', cursor: 'copy' },
  { id: 'image', label: 'Image', icon: 'image', group: 4, groupName: 'Insert', cursor: 'crosshair' },
  { id: 'signature', label: 'Signature', short: 'Sign', icon: 'signature', hotkey: 's', group: 4, groupName: 'Insert', cursor: 'crosshair' },
  { id: 'link', label: 'Link', icon: 'link', group: 4, groupName: 'Insert', cursor: 'crosshair' },
  { id: 'field-text', label: 'Text field', short: 'Text', icon: 'field', group: 5, groupName: 'Form fields', cursor: 'crosshair' },
  { id: 'field-checkbox', label: 'Checkbox', short: 'Check', icon: 'checkbox', group: 5, groupName: 'Form fields', cursor: 'crosshair' },
  { id: 'field-dropdown', label: 'Dropdown', short: 'Dropdown', icon: 'dropdown', group: 5, groupName: 'Form fields', cursor: 'crosshair' },
  { id: 'field-radio', label: 'Radio group', short: 'Radio', icon: 'radio', group: 5, groupName: 'Form fields', cursor: 'crosshair' },
];

export const TOOL_BY_ID = new Map(TOOLS.map((t) => [t.id, t]));
