import React from 'react';
import { useTranslation } from '../hooks/use-translation';
import { jsx as _jsx } from "react/jsx-runtime";
export const CHART_LEGEND_ITEM_GLYPH_TYPES = {
  CROSS: 'CROSS',
  CIRCLE: 'CIRCLE',
  DISC: 'DISC',
  VERTICAL_LINE: 'VERTICAL_LINE',
  HORIZONTAL_LINE: 'HORIZONTAL_LINE',
  SQUARE: 'SQUARE'
};
export function ChartLegendItemGlyph({
  glyphType,
  color,
  glyphAriaLabels
}) {
  const {
    t
  } = useTranslation();
  const defaultAriaLabels = {
    [CHART_LEGEND_ITEM_GLYPH_TYPES.CROSS]: t('Cross'),
    [CHART_LEGEND_ITEM_GLYPH_TYPES.CIRCLE]: t('Circle'),
    [CHART_LEGEND_ITEM_GLYPH_TYPES.DISC]: t('Disc'),
    [CHART_LEGEND_ITEM_GLYPH_TYPES.VERTICAL_LINE]: t('Vertical line'),
    [CHART_LEGEND_ITEM_GLYPH_TYPES.HORIZONTAL_LINE]: t('Horizontal line'),
    [CHART_LEGEND_ITEM_GLYPH_TYPES.SQUARE]: t('Square')
  };
  const ariaLabel = glyphAriaLabels?.[glyphType] ?? defaultAriaLabels[glyphType];
  if (glyphType === CHART_LEGEND_ITEM_GLYPH_TYPES.CROSS) {
    return /*#__PURE__*/_jsx("svg", {
      width: "12",
      height: "12",
      "aria-label": ariaLabel,
      children: /*#__PURE__*/_jsx("polygon", {
        "test-id": "chart-legend-item-glyph",
        className: "chart-legend-item-glyph",
        points: "12,5 7,5 7,0 5,0 5,5 0,5 0,7 5,7 5,12 7,12 7,7 12,7",
        fill: color,
        stroke: "transparent"
      })
    });
  }
  if (glyphType === CHART_LEGEND_ITEM_GLYPH_TYPES.CIRCLE) {
    return /*#__PURE__*/_jsx("svg", {
      width: "12",
      height: "12",
      "aria-label": ariaLabel,
      children: /*#__PURE__*/_jsx("circle", {
        "test-id": "chart-legend-item-glyph",
        className: "chart-legend-item-glyph",
        cx: "6",
        cy: "6",
        r: "5",
        strokeWidth: "2",
        stroke: color,
        fill: "transparent"
      })
    });
  }
  if (glyphType === CHART_LEGEND_ITEM_GLYPH_TYPES.DISC) {
    return /*#__PURE__*/_jsx("svg", {
      width: "12",
      height: "12",
      "aria-label": ariaLabel,
      children: /*#__PURE__*/_jsx("circle", {
        "test-id": "chart-legend-item-glyph",
        className: "chart-legend-item-glyph",
        cx: "6",
        cy: "6",
        r: "5",
        strokeWidth: "0",
        fill: color
      })
    });
  }
  if (glyphType === CHART_LEGEND_ITEM_GLYPH_TYPES.VERTICAL_LINE) {
    return /*#__PURE__*/_jsx("svg", {
      width: "12",
      height: "12",
      "aria-label": ariaLabel,
      children: /*#__PURE__*/_jsx("rect", {
        "test-id": "chart-legend-item-glyph",
        className: "chart-legend-item-glyph",
        x: "5",
        y: "0",
        width: "2",
        height: "12",
        strokeWidth: "0",
        fill: color
      })
    });
  }
  if (glyphType === CHART_LEGEND_ITEM_GLYPH_TYPES.HORIZONTAL_LINE) {
    return /*#__PURE__*/_jsx("svg", {
      width: "12",
      height: "12",
      "aria-label": ariaLabel,
      children: /*#__PURE__*/_jsx("rect", {
        "test-id": "chart-legend-item-glyph",
        className: "chart-legend-item-glyph",
        x: "0",
        y: "5",
        width: "12",
        height: "2",
        strokeWidth: "0",
        fill: color
      })
    });
  }
  if (glyphType === CHART_LEGEND_ITEM_GLYPH_TYPES.SQUARE) {
    return /*#__PURE__*/_jsx("svg", {
      width: "12",
      height: "12",
      "aria-label": ariaLabel,
      children: /*#__PURE__*/_jsx("rect", {
        "test-id": "chart-legend-item-glyph",
        className: "chart-legend-item-glyph",
        width: "12",
        height: "12",
        fill: color
      })
    });
  }
  return null;
}