import {
  type NavigationSidebarGroup,
  type ResolveSidebarGroupsParams,
} from './types';

export const resolveSidebarGroups = <T>({
  items,
  groups,
}: ResolveSidebarGroupsParams<T>): NavigationSidebarGroup<T>[] => {
  if (groups) return groups;
  if (items && items.length > 0) return [{ items }];
  return [];
};
