import type { ReflectionKind } from '@/api/reflection'

/** 管理页「查看对象」可跳转地图并定位的反射 kind（进程/脚本等逻辑对象除外）。 */
export type MapFocusKind = 'car' | 'site' | 'track' | 'special'

const MAP_VIEWABLE_KINDS = new Set<ReflectionKind>(['car', 'vehicle', 'site', 'track', 'special'])

export function isMapViewableKind(kind: ReflectionKind): boolean {
  return MAP_VIEWABLE_KINDS.has(kind)
}

export function toMapFocusKind(kind: ReflectionKind): MapFocusKind | null {
  if (kind === 'vehicle' || kind === 'car') return 'car'
  if (kind === 'site' || kind === 'track' || kind === 'special') return kind
  return null
}

export const MAP_MONITOR_PATH = '/admin/map-monitor'

export function buildMapFocusQuery(kind: MapFocusKind, id: number) {
  return { focusKind: kind, focusId: String(id) }
}
