import { DATA_CATEGORIES } from '@/constants/dataTypes.js'

export const DATA_SPACES = [
  { id: 'geophys-main', label: '深海地球物理数据空间' },
  { id: 'geophys-south', label: '南海地球物理调查数据空间' },
  { id: 'geophys-pacific', label: '西太平洋地球物理数据空间' }
]

/**
 * 根据数据类型常量生成目录树
 * @returns {Array}
 */
function buildDirectoryTree() {
  const children = DATA_CATEGORIES.map((category) => {
    if (category.children.length > 0) {
      return {
        id: category.value,
        label: category.label,
        children: category.children.map((child) => ({
          id: child.value,
          label: child.label
        }))
      }
    }
    return {
      id: category.value,
      label: category.label
    }
  })

  return [{
    id: 'root',
    label: '深海地球物理数据空间',
    children
  }]
}

/**
 * 目录树结构（按地球物理数据类型组织）
 */
export const DIRECTORY_TREE = buildDirectoryTree()

/**
 * 各目录下文件
 * @type {Record<string, Array>}
 */
export const FILES_BY_FOLDER = {
  ship_multibeam: [
    {
      id: 'mb-ship-1',
      name: 'MB-ship-line001.all',
      ext: 'all',
      size: 2147483648,
      update_time: '2024-03-15 10:30:00'
    },
    {
      id: 'mb-ship-2',
      name: 'MB-ship-line002.all',
      ext: 'all',
      size: 1879048192,
      update_time: '2024-03-15 11:20:00'
    }
  ],
  submarine_multibeam: [
    {
      id: 'mb-sub-1',
      name: 'HROV-MB-survey-001.nc',
      ext: 'nc',
      size: 536870912,
      update_time: '2024-03-18 09:15:00'
    }
  ],
  sidescan: [
    {
      id: 'ss-1',
      name: 'SSS-track-001.xtf',
      ext: 'xtf',
      size: 1048576000,
      update_time: '2024-03-20 14:00:00'
    },
    {
      id: 'ss-2',
      name: 'SSS-mosaic.tif',
      ext: 'tif',
      size: 524288000,
      update_time: '2024-03-21 09:30:00'
    }
  ],
  shallow_seismic: [
    {
      id: 'sh-se-1',
      name: 'CHIRP-profile-001.sgy',
      ext: 'sgy',
      size: 3221225472,
      update_time: '2024-04-02 08:30:00'
    }
  ],
  seismic_2d: [
    {
      id: 'se-2d-1',
      name: '2D-line001.sgy',
      ext: 'sgy',
      size: 4294967296,
      update_time: '2024-04-02 09:45:00'
    },
    {
      id: 'se-2d-2',
      name: '2D-line002.sgy',
      ext: 'sgy',
      size: 3758096384,
      update_time: '2024-04-03 10:15:00'
    }
  ],
  seismic_3d: [
    {
      id: 'se-3d-1',
      name: '3D-cube-volume.segy',
      ext: 'segy',
      size: 8589934592,
      update_time: '2024-04-05 16:20:00'
    }
  ],
  obn_seismic: [
    {
      id: 'obn-1',
      name: 'OBN-receiver-nodes.rar',
      ext: 'rar',
      size: 6442450944,
      update_time: '2024-04-08 11:00:00'
    }
  ],
  gravity: [
    {
      id: 'grav-1',
      name: 'gravity-anomaly-grid.grd',
      ext: 'grd',
      size: 67108864,
      update_time: '2024-04-10 08:00:00'
    }
  ],
  ship_magnetic: [
    {
      id: 'mag-ship-1',
      name: 'MAG-ship-track-001.mgd',
      ext: 'mgd',
      size: 134217728,
      update_time: '2024-04-12 13:45:00'
    }
  ],
  submarine_magnetic: [
    {
      id: 'mag-sub-1',
      name: 'HROV-MAG-survey-001.dat',
      ext: 'dat',
      size: 268435456,
      update_time: '2024-04-14 15:20:00'
    }
  ],
  ctd: [
    {
      id: 'ctd-1',
      name: 'CTD-cast-001.cnv',
      ext: 'cnv',
      size: 2097152,
      update_time: '2024-04-16 07:30:00'
    },
    {
      id: 'ctd-2',
      name: 'CTD-profile-summary.csv',
      ext: 'csv',
      size: 524288,
      update_time: '2024-04-16 08:00:00'
    }
  ],
  adcp: [
    {
      id: 'adcp-1',
      name: 'ADCP-current-profile.pd0',
      ext: 'pd0',
      size: 4194304,
      update_time: '2024-04-18 10:00:00'
    }
  ],
  heat_flow: [
    {
      id: 'hf-1',
      name: 'heat-flow-station-001.txt',
      ext: 'txt',
      size: 65536,
      update_time: '2024-04-20 14:30:00'
    }
  ]
}

/**
 * 默认选中目录
 */
export const DEFAULT_FOLDER_ID = 'ship_multibeam'
