import type { ExportTaskScene } from '@/types/api'

export interface ExportTaskScenePermissions {
  detail: string
  download: string
  cancel: string
}

export interface ExportTaskSceneConfig {
  scene: ExportTaskScene
  sceneName: string
  pageTitle: string
  permissions: ExportTaskScenePermissions
}

export const EXPORT_TASK_SCENE_CONFIG: Record<ExportTaskScene, ExportTaskSceneConfig> = {
  device: {
    scene: 'device',
    sceneName: '设备管理',
    pageTitle: '导出设备',
    permissions: {
      detail: 'export_task:device_detail',
      download: 'export_task:device_download',
      cancel: 'export_task:device_cancel'
    }
  },
  iot_card: {
    scene: 'iot_card',
    sceneName: 'IOT卡管理',
    pageTitle: '导出IOT卡',
    permissions: {
      detail: 'export_task:iot_card_detail',
      download: 'export_task:iot_card_download',
      cancel: 'export_task:iot_card_cancel'
    }
  },
  order: {
    scene: 'order',
    sceneName: '订单管理',
    pageTitle: '导出订单',
    permissions: {
      detail: 'export_task:order_detail',
      download: 'export_task:order_download',
      cancel: 'export_task:order_cancel'
    }
  }
}

export const getExportTaskSceneConfig = (scene?: ExportTaskScene) => {
  return scene ? EXPORT_TASK_SCENE_CONFIG[scene] : undefined
}

export const getExportTaskSceneName = (scene?: ExportTaskScene) => {
  return getExportTaskSceneConfig(scene)?.sceneName || '-'
}
