/**
 * Mark → wireframe glyph ledger (composition wireframe leaves, arch 08). Maps a
 * unit view's Vega-Lite mark type to its glyph in the Icon vocabulary's `mark-*`
 * sub-family, collapsing synonyms (circle/square → point, trail → line, image →
 * rect) so the set stays small; anything unmapped or absent falls to `mark-generic`.
 */

import type { IconName } from './Icon';

const MARK_ICON: Record<string, IconName> = {
  bar: 'mark-bar',
  line: 'mark-line',
  trail: 'mark-line',
  area: 'mark-area',
  point: 'mark-point',
  circle: 'mark-point',
  square: 'mark-point',
  tick: 'mark-tick',
  rect: 'mark-rect',
  image: 'mark-rect',
  arc: 'mark-arc',
  rule: 'mark-rule',
  text: 'mark-text',
};

export const markIconName = (mark?: string): IconName =>
  (mark && MARK_ICON[mark]) || 'mark-generic';
