// src/editor/toolbar/toolbar-config.js

export const buttonDefs = {
  'h2': { labelKey: 'Heading2', method: 'insTag', args: ['===', '===', 0, 1] },
  'h3': { labelKey: 'Heading3', method: 'insTag', args: ['====', '====', 0, 1] },
  'h4': { labelKey: 'Heading4', method: 'insTag', args: ['=====', '=====', 0, 1] },
  'h5': { labelKey: 'Heading5', method: 'insTag', args: ['======', '======', 0, 1] },
  'h6': { labelKey: 'Heading6', method: 'insTag', args: ['=======', '=======', 0, 1] },
  'bold': { labelKey: 'Bold', method: 'insTag', args: ['**', '**'] },
  'italic': { labelKey: 'Italic', method: 'insTag', args: ['//', '//'] },
  'underline': { labelKey: 'Underline', method: 'insTag', args: ['__', '__'] },
  'strike': { labelKey: 'Strikethrough', method: 'insTag', args: ['--', '--'] },
  'small': { labelKey: 'Small', method: 'insTag', args: ['++', '++'] },
  'code': { labelKey: 'Code', method: 'insTag', args: ['##', '##'] },
  'ul': { labelKey: 'List', method: 'insTag', args: ['  * ', '', 0, 1, 1] },
  'ol': { labelKey: 'NumberedList', method: 'insTag', args: ['  1. ', '', 0, 1, 1] },
  'center': { labelKey: 'Center', method: 'insBlockWrapper', args: ['%%(wacko wrapper=text wrapper_align=center)'] },
  'right': { labelKey: 'Right', method: 'insBlockWrapper', args: ['%%(wacko wrapper=text wrapper_align=right)'] },
  'justify': { labelKey: 'Justify', method: 'insBlockWrapper', args: ['%%(wacko wrapper=text wrapper_align=justify)'] },
  'outdent': { labelKey: 'Outdent', method: 'unindent', args: [] },
  'indent': { labelKey: 'Indent', method: 'insTag', args: ['  ', '', 0, 1] },
  'quote': { labelKey: 'Quote', method: 'insTag', args: ['<[', ']>', 2] },
  'source': { labelKey: 'CodeWrapper', method: 'insBlockWrapper', args: ['%%'] },
  'action': { labelKey: 'Action', method: 'insTag', args: ['{{', '}}', 2] },
  'textred': { labelKey: 'MarkedText', method: 'insTag', args: ['!!', '!!', 2] },
  'highlight': { labelKey: 'HighlightText', method: 'insTag', args: ['??', '??', 2] },
  'hr': { labelKey: 'HorizontalRule', method: 'insTag', args: ['', '\n----\n', 2] },
  'signature': { labelKey: 'Signature', method: 'insTag', args: ['::@::', ' ', 1] },
  'createlink': { labelKey: 'Hyperlink', method: 'createLink', args: [] },
  'footnote': { labelKey: 'Footnote', method: 'insTag', args: ['[[^ ', ']]', 2] },
  'createtable': { labelKey: 'InsertTable', method: 'createTable', args: [] },
  'upload-media': { labelKey: 'Upload', method: 'triggerFileUpload', condition: 'canUpload' },
  'wacko2md': { label: 'Wacko → MD', method: 'convertToMarkdown', args: [] },
  'md2wacko': { label: 'MD → Wacko', method: 'convertToWacko', args: [] },
  'dark-toggle': { labelKey: 'ToggleDark', method: 'toggleDarkMode', args: [] },
  'syntax': { labelKey: 'SyntaxHighlighting', method: 'toggleSyntaxHighlight', args: [] },
  'livepreview': { labelKey: 'LivePreview', method: 'toggleLivePreview', condition: 'isRegisteredUser' },
  'zenmode': { labelKey: 'ZenMode', method: 'toggleZenMode', args: [] },
  'fullscreen': { labelKey: 'Fullscreen', method: 'toggleFullscreen', args: [] },
  'shrink': { labelKey: 'HeightShrink', method: 'changeEditorHeight', args: [-100] },
  'enlarge': { labelKey: 'HeightEnlarge', method: 'changeEditorHeight', args: [100] },
  'undo': { labelKey: 'Undo', method: 'undo', args: [] },
  'redo': { labelKey: 'Redo', method: 'redo', args: [] },
  'search': { labelKey: 'SearchReplace', method: 'showFindReplace', args: [] },
  'about': { labelKey: 'HelpAbout', method: 'showHelpModal', args: [] },
};

export function getDefaultToolbarOrder() {
  return [
    'h2', 'h3', 'h4', 'h5', 'h6', 'separator',
    'bold', 'italic', 'underline', 'strike', 'small', 'code', 'separator',
    'ul', 'ol', 'separator',
    'center', 'right', 'justify', 'separator',
    'outdent', 'indent', 'separator',
    'quote', 'source', 'action', 'textred', 'highlight', 'separator',
    'hr', 'signature', 'createlink', 'footnote', 'createtable',
    'upload-media', 'separator',
    'wacko2md', 'md2wacko', 'separator',
    'dark-toggle', 'syntax', 'livepreview', 'zenmode', 'fullscreen', 'separator',
    'shrink', 'enlarge', 'separator',
    'undo', 'redo', 'separator', 'search', 'about',
    'dropdown',
  ];
}
