const TOOL_ENTRIES = [
  { view: 'crc', label: 'CRC与哈希计算', icon: 'icon-crc', iconSrc: '/assets/icons/hash-white.png' },
  { view: 'filter', label: '滤波器计算', icon: 'icon-filter', iconSrc: '/assets/icons/funnel-white.png' },
  { view: 'reactance', label: '电抗计算', icon: 'icon-reactance', iconSrc: '/assets/icons/audio-waveform-white.png' },
  { view: 'smdCode', label: '贴片电阻/容代码', icon: 'icon-smd', iconSrc: '/assets/icons/microchip-white.png' },
  { view: 'refrigeration', label: '制冷计算', icon: 'icon-snow', iconSrc: '/assets/icons/snowflake-white.png' },
  { view: 'threePhasePower', label: '三相功率计算', icon: 'icon-three-phase', iconSrc: '/assets/icons/zap-white.png' }
]

function getToolEntries() {
  return TOOL_ENTRIES.map((item) => ({ ...item }))
}

function isToolView(view) {
  return TOOL_ENTRIES.some((item) => item.view === view)
}

function getToolEntry(view) {
  return TOOL_ENTRIES.find((item) => item.view === view) || null
}

function getToolTitle(view) {
  const entry = getToolEntry(view)
  return entry ? entry.label : ''
}

module.exports = {
  getToolEntry,
  getToolEntries,
  getToolTitle,
  isToolView
}
