export type MapTarget = {
  lat: number
  lng: number
  zoom: number
  marker?: boolean
  name?: string
  address?: string
  bookmarkId?: string
}

let pending: MapTarget | null = null

export const MAP_NAV_EVENT = 'map-nav'

export function setMapNav(target: MapTarget | null): void {
  pending = target
  if (target) globalThis.dispatchEvent(new CustomEvent(MAP_NAV_EVENT))
}

export function getMapNav(): MapTarget | null {
  return pending
}
