import { CATEGORY_IMAGES } from '@/constants/homeImages.js'

/**
 * 首页数据资源分类
 */
export const HOME_RESOURCE_CATEGORIES = [
  {
    id: 'acoustic',
    label: '声学测量数据',
    desc: '多波束、侧扫声呐',
    route: '/demand',
    query: { category: 'acoustic' },
    count: 3,
    cover: CATEGORY_IMAGES.acoustic
  },
  {
    id: 'seismic',
    label: '地震勘探数据',
    desc: '浅剖、2D/3D、OBN',
    route: '/demand',
    query: { category: 'seismic' },
    count: 4,
    cover: CATEGORY_IMAGES.seismic
  },
  {
    id: 'potential',
    label: '重磁位场数据',
    desc: '重力、磁力测量',
    route: '/demand',
    query: { category: 'potential' },
    count: 3,
    cover: CATEGORY_IMAGES.potential
  },
  {
    id: 'ocean',
    label: '海洋环境数据',
    desc: 'CTD、ADCP、热流',
    route: '/demand',
    query: { category: 'ocean' },
    count: 3,
    cover: CATEGORY_IMAGES.ocean
  }
]

/**
 * 首页 Hero 统计卡片
 */
export const HOME_STAT_CARDS = [
  { key: 'multibeam', label: '多波束', value: '2', unit: '类' },
  { key: 'seismic', label: '地震数据', value: '4', unit: '类' },
  { key: 'magnetic', label: '磁力数据', value: '2', unit: '类' },
  { key: 'sidescan', label: '侧扫数据', value: '1', unit: '类' },
  { key: 'dataset', label: '数据集', value: '13', unit: '个' },
  { key: 'gravity', label: '重力数据', value: '1', unit: '类' },
  { key: 'ocean', label: '海洋观测', value: '3', unit: '类' },
  { key: 'records', label: '数据记录', value: '82,454', unit: '条' }
]

/**
 * 热门数据排序字段
 */
export const HOT_DATA_TABS = [
  { key: 'views', label: '浏览量' },
  { key: 'downloads', label: '下载量' },
  { key: 'focus', label: '关注度' }
]

/**
 * 为 mock 数据附加热门指标
 * @param {Array} dataList
 * @returns {Array}
 */
export function enrichHotDataMetrics(dataList) {
  return dataList.map((item, index) => ({
    ...item,
    views: 1280 - index * 86,
    downloads: 356 - index * 28,
    focus: 96 - index * 6,
    hotRank: index + 1
  }))
}
