// Types (single source of truth)
export type {
  // Marker
  MarkerData,
  // Viewport
  MapViewport,
  // Context
  MapContextValue,
  // Hook return types
  MapControlActions,
  MarkerActions,
  MapEventHandlers,
  MapMouseEvent,
  // Style
  MapStyleKey,
  // Layer specs (re-exported from react-map-gl)
  LayerProps,
  FillLayerSpecification,
  CircleLayerSpecification,
  LineLayerSpecification,
  SymbolLayerSpecification,
  FilterSpecification,
  ControlPosition,
  MarkerProps,
  // Layer options
  ClusterLayerOptions,
  PointLayerOptions,
  PolygonLayerOptions,
  LineLayerOptions,
  RouteLayerOptions,
  SymbolLayerOptions,
  // Control props
  DrawControlProps,
  CustomOverlayProps,
  // Legend
  LegendItem,
  MapLegendProps,
  // Layer switcher
  LayerConfig,
  LayerSwitcherProps,
} from './types'

// Context
export { MapProvider, useMapContext, MapContext } from './context'
export type { MapProviderProps } from './context'

// Hooks
export {
  useMap,
  useMapControl,
  useMarkers,
  useMapEvents,
  useMapViewport,
  useMapLayers,
  useMapImages,
  useMeasure,
  useTerrain,
  useCompass,
  useGeolocation,
  useControl,
  useDraggableMarkers,
  useGeocoder,
  useMarkerCard,
  type UseMarkerCardResult,
  type UseCompassResult,
  type UseGeocoderOptions,
  type UseGeocoderResult,
  type MapImage,
  type UseMapImagesResult,
  type UseMeasureResult,
  type MeasureMode,
  type UseTerrainOptions,
  type GeolocationFix,
  type GeolocationStatus,
  type UseGeolocationOptions,
  type UseGeolocationResult,
  type DraggablePoint,
  type UseDraggableMarkersOptions,
  type UseDraggableMarkersResult,
  type DraggableMarkerHandlers,
} from './hooks'

// Components
export {
  MapContainer,
  MapView,
  MapControls,
  MapMarker,
  MapPopup,
  MapCluster,
  MapSource,
  MapLayer,
  CustomOverlay,
  MapLegend,
  LayerSwitcher,
  MeasureControl,
  DraggableMarkers,
  GeocoderInput,
  GeocoderControl,
  CompassChip,
  MarkerCard,
  MapMarkers,
} from './components'
export type {
  MapContainerProps,
  GeolocateOptions,
  GeolocatePosition,
  MapControlsProps,
  MapMarkerProps,
  MapPopupProps,
  MapClusterProps,
  MapSourceProps,
  MapLayerProps,
  MeasureControlProps,
  DraggableMarkersProps,
  GeocoderInputProps,
  GeocoderControlProps,
  CompassChipProps,
  MarkerCardProps,
  MapMarkersProps,
  MarkerWithCard,
  MarkerCardAction,
  MarkerCardData,
  MarkerCardActionData,
} from './components'

// The card-data shape. `MarkerCard` (value) is the component above; the data
// type ships as `MarkerCardInfo` to avoid colliding with that value export.
export type { MarkerCard as MarkerCardInfo } from './cards'

// Geocoder resolver — pure, key-free (light; no maplibre runtime).
export { photonResolve, cameraForResult } from './geocode'
export type { GeocodeResult, GeocodeKind, ResolveGeocode } from './geocode'

// Layers
export {
  createClusterLayers,
  createPointLayer,
  createHeatmapLayer,
  createPolygonLayer,
  createPolygonOutlineLayer,
  createHighlightLayer,
  createLineLayer,
  createRouteLayers,
  createDashedLineLayer,
  createAnimatedLineLayer,
  createSymbolLayer,
} from './layers'

// Styles
export { MAP_STYLES, getMapStyle, TERRAIN_DEM, TERRAIN_DEM_URL } from './styles'

// PMTiles protocol — opt-in self-hosted / offline basemaps (no tile server)
export { addPMTilesProtocol, pmtilesSourceUrl } from './protocols/pmtiles'

// Utils
export {
  calculateBounds,
  calculateCenter,
  calculateDistance,
  isPointInBounds,
  expandBounds,
  toGeoJSON,
  fromGeoJSON,
  createPoint,
  createPolygon,
  createLineString,
  createFeatureCollection,
} from './utils'

// Re-export useful types from react-map-gl
export type { ViewState, MapRef } from 'react-map-gl/maplibre'
export { Source, Layer, Marker, Popup } from 'react-map-gl/maplibre'
