import type { CSSProperties } from 'react';
import type { Theme } from '@/styles/theme';

export function getChartLegendProps(theme: Theme): {
  iconType: 'circle';
  iconSize: number;
  wrapperStyle: CSSProperties;
  formatter: (value: string) => string;
} {
  return {
    iconType: 'circle',
    iconSize: 8,
    wrapperStyle: {
      fontSize: '0.8125rem',
      fontWeight: 500,
      color: theme.colors.text.secondary,
      paddingTop: 4,
      lineHeight: 1.4,
    },
    formatter: (value: string) => value,
  };
}

export function createLegendFormatter(
  labelMap: Record<string, string>,
): (value: string) => string {
  return (value: string) => labelMap[value] ?? value;
}
