import { type Group } from '@material-hu/components/composed-components/CollapsibleGroupSelector/types';

type LabeledGroupWithStringableIds = {
  name: string;
  value: number | string;
  items: Array<{ label: string; value: number | string }>;
};

export function toCollapsibleSelectorGroups(
  groups: LabeledGroupWithStringableIds[],
): Group[] {
  return groups.map(group => ({
    name: group.name,
    value: String(group.value),
    items: group.items.map(item => ({
      label: item.label,
      value: String(item.value),
    })),
  }));
}
