import { SettingsPages } from './SettingsPages';

export type SettingsSearchEntry = {
  page: SettingsPages;
  /** Primary label shown in results. */
  title: string;
  /** Extra terms for fuzzy matching (aliases, related words). */
  keywords?: string[];
};

/**
 * Catalog of settings pages and individual tiles for fuzzy search.
 * Keep titles aligned with SettingTile labels in each page.
 */
export const SETTINGS_SEARCH_CATALOG: SettingsSearchEntry[] = [
  // Pages
  { page: SettingsPages.GeneralPage, title: 'General', keywords: ['appearance', 'theme', 'messages', 'editor'] },
  { page: SettingsPages.AccountPage, title: 'Account', keywords: ['profile', 'email', 'mxid', 'ignore'] },
  {
    page: SettingsPages.NotificationPage,
    title: 'Notifications',
    keywords: ['alerts', 'push', 'desktop', 'sound', 'mentions'],
  },
  { page: SettingsPages.AudioPage, title: 'Audio & Video', keywords: ['microphone', 'speaker', 'call', 'camera'] },
  { page: SettingsPages.DevicesPage, title: 'Devices', keywords: ['sessions', 'verification', 'backup', 'export'] },
  {
    page: SettingsPages.EmojisStickersPage,
    title: 'Emojis & Stickers',
    keywords: ['emoticons', 'stickers', 'telegram', 'custom emoji'],
  },
  { page: SettingsPages.PluginsPage, title: 'Plugins', keywords: ['extensions', 'addons', 'marketplace'] },
  {
    page: SettingsPages.DeveloperToolsPage,
    title: 'Developer Tools',
    keywords: ['debug', 'token', 'account data'],
  },
  { page: SettingsPages.AboutPage, title: 'About', keywords: ['version', 'cache', 'protocol', 'paarrot'] },

  // General
  {
    page: SettingsPages.GeneralPage,
    title: 'System Theme',
    keywords: ['appearance', 'dark', 'light', 'auto'],
  },
  { page: SettingsPages.GeneralPage, title: 'Theme', keywords: ['appearance', 'color scheme'] },
  { page: SettingsPages.GeneralPage, title: 'Monochrome Mode', keywords: ['grayscale', 'appearance'] },
  { page: SettingsPages.GeneralPage, title: 'Emoji Style', keywords: ['appearance', 'twemoji', 'native'] },
  { page: SettingsPages.GeneralPage, title: 'Page Zoom', keywords: ['scale', 'accessibility', 'size'] },
  { page: SettingsPages.GeneralPage, title: 'Date Format', keywords: ['time', 'calendar'] },
  { page: SettingsPages.GeneralPage, title: '24-Hour Time Format', keywords: ['clock', 'time'] },
  { page: SettingsPages.GeneralPage, title: 'ENTER for Newline', keywords: ['editor', 'keyboard', 'shift enter'] },
  { page: SettingsPages.GeneralPage, title: 'Markdown Formatting', keywords: ['editor', 'formatting'] },
  {
    page: SettingsPages.GeneralPage,
    title: 'Hide Typing & Read Receipts',
    keywords: ['privacy', 'activity', 'typing'],
  },
  { page: SettingsPages.GeneralPage, title: 'Auto-Join Space Rooms', keywords: ['spaces', 'join'] },
  { page: SettingsPages.GeneralPage, title: 'Message Layout', keywords: ['bubbles', 'compact', 'modern'] },
  { page: SettingsPages.GeneralPage, title: 'Message Spacing', keywords: ['density', 'gap'] },
  {
    page: SettingsPages.GeneralPage,
    title: 'Scroll to Latest on Room Reselect',
    keywords: ['timeline', 'jump'],
  },
  { page: SettingsPages.GeneralPage, title: 'Legacy Username Color', keywords: ['appearance', 'mxid color'] },
  { page: SettingsPages.GeneralPage, title: 'Hide Membership Change', keywords: ['joins', 'leaves', 'timeline'] },
  { page: SettingsPages.GeneralPage, title: 'Hide Profile Change', keywords: ['avatar', 'displayname', 'timeline'] },
  { page: SettingsPages.GeneralPage, title: 'Disable Media Auto Load', keywords: ['images', 'bandwidth', 'lazy'] },
  { page: SettingsPages.GeneralPage, title: 'Url Preview', keywords: ['link', 'embed', 'unfurl'] },
  {
    page: SettingsPages.GeneralPage,
    title: 'Url Preview in Encrypted Room',
    keywords: ['e2ee', 'link', 'embed'],
  },
  { page: SettingsPages.GeneralPage, title: 'Show Hidden Events', keywords: ['state', 'debug', 'timeline'] },

  // Account
  { page: SettingsPages.AccountPage, title: 'Profile', keywords: ['displayname', 'avatar', 'name'] },
  { page: SettingsPages.AccountPage, title: 'Email Address', keywords: ['contact', 'mail'] },
  { page: SettingsPages.AccountPage, title: 'Ignored Users', keywords: ['block', 'mute', 'ignore'] },

  // Notifications
  { page: SettingsPages.NotificationPage, title: 'Desktop Notifications', keywords: ['system', 'os'] },
  { page: SettingsPages.NotificationPage, title: 'Notification Sound', keywords: ['audio', 'alert'] },
  { page: SettingsPages.NotificationPage, title: 'Email Notification', keywords: ['mail'] },
  { page: SettingsPages.NotificationPage, title: 'Background Notifications', keywords: ['tray', 'electron'] },
  { page: SettingsPages.NotificationPage, title: '1-to-1 Chats', keywords: ['dm', 'direct'] },
  { page: SettingsPages.NotificationPage, title: 'Rooms', keywords: ['messages', 'push'] },
  { page: SettingsPages.NotificationPage, title: 'Mention @room', keywords: ['highlight', 'ping'] },
  { page: SettingsPages.NotificationPage, title: 'Keyword Messages', keywords: ['highlight', 'filter'] },
  { page: SettingsPages.NotificationPage, title: 'Special Messages', keywords: ['mentions', 'displayname'] },
  { page: SettingsPages.NotificationPage, title: 'Test Notification', keywords: ['preview', 'sound'] },

  // Audio & Video
  { page: SettingsPages.AudioPage, title: 'Input Device', keywords: ['microphone', 'mic'] },
  { page: SettingsPages.AudioPage, title: 'Output Device', keywords: ['speaker', 'headphones'] },
  { page: SettingsPages.AudioPage, title: 'Noise Suppression', keywords: ['microphone', 'processing'] },
  { page: SettingsPages.AudioPage, title: 'Echo Cancellation', keywords: ['microphone', 'aec'] },
  { page: SettingsPages.AudioPage, title: 'Auto Gain Control', keywords: ['microphone', 'agc'] },
  { page: SettingsPages.AudioPage, title: 'Resolution', keywords: ['screen share', 'video'] },
  { page: SettingsPages.AudioPage, title: 'Bitrate', keywords: ['screen share', 'quality'] },
  { page: SettingsPages.AudioPage, title: 'Frame Rate', keywords: ['screen share', 'fps'] },
  { page: SettingsPages.AudioPage, title: 'Show Remote Cursor', keywords: ['screen share', 'pointer'] },

  // Devices
  { page: SettingsPages.DevicesPage, title: 'Device Verification', keywords: ['crypto', 'cross signing'] },
  { page: SettingsPages.DevicesPage, title: 'Device Dashboard', keywords: ['sessions', 'logout'] },
  { page: SettingsPages.DevicesPage, title: 'Export Messages Data', keywords: ['backup', 'download'] },
  { page: SettingsPages.DevicesPage, title: 'Import Messages Data', keywords: ['backup', 'restore'] },

  // Emojis & Stickers
  {
    page: SettingsPages.EmojisStickersPage,
    title: 'Auto-convert Text Emoticons',
    keywords: ['smileys', 'colon'],
  },
  { page: SettingsPages.EmojisStickersPage, title: 'Telegram Bot Token', keywords: ['stickers', 'import'] },
  { page: SettingsPages.EmojisStickersPage, title: 'Sticker Pack URL', keywords: ['telegram', 'import'] },

  // Developer Tools
  {
    page: SettingsPages.DeveloperToolsPage,
    title: 'Enable Developer Tools',
    keywords: ['debug'],
  },
  { page: SettingsPages.DeveloperToolsPage, title: 'Access Token', keywords: ['auth', 'secret'] },
  { page: SettingsPages.DeveloperToolsPage, title: 'Account Data', keywords: ['global', 'events'] },

  // About
  { page: SettingsPages.AboutPage, title: 'Clear Cache & Reload', keywords: ['reset', 'storage'] },
  {
    page: SettingsPages.AboutPage,
    title: 'Protocol Handler (paarrot://)',
    keywords: ['deeplink', 'url scheme'],
  },
];
