import type { Edges } from "@/types/requests/utils/edges"
import type { NodeRefs } from "@/types/requests/utils/refs"
import type { GetNavigationMyPagesRefsData } from "./output"

export function getConnections(refs: GetNavigationMyPagesRefsData) {
  const connections: Edges<NodeRefs>[] = []
  refs.all_navigation_my_pages.items.forEach((ref) => {
    ref.menu_items.forEach((menuItem) => {
      menuItem.links.map((link) => {
        connections.push(link.page)
      })
    })
  })

  return connections
}
