import type { Tooltip } from './types'

/**
 * Returns the default CSS cursor style based on the current map interaction state.
 *
 * @param isDragging - Whether the user is currently dragging the map.
 * @param isHovering - Whether the cursor is hovering over a pickable feature.
 * @returns `'grabbing'` when dragging, `'pointer'` when hovering, or `'grab'` otherwise.
 */
export function getCursorDefault({
  isDragging,
  isHovering,
}: {
  isHovering: boolean
  isDragging: boolean
}) {
  return isDragging ? 'grabbing' : isHovering ? 'pointer' : 'grab'
}

/**
 * Returns the default tooltip configuration for deck.gl, wrapping the tooltip HTML content in a styled container.
 *
 * @param info - Tooltip info object containing an optional `html` string.
 * @returns A tooltip descriptor with `html` and `style`, or `null` if no HTML content is present.
 */
export function getTooltipDefault(info: Tooltip) {
  if (!info.html) return null

  return {
    html: `<div class='map-tooltip__content'>${info.html}</div>`,
    style: {
      padding: '0',
      background: 'none',
    },
  }
}
