import { Lang } from "@/constants/languages"

import type { GetMyPagesBreadcrumbsRefsData } from "@/types/requests/myPages/breadcrumbs"
import type { Edges } from "@/types/requests/utils/edges"
import type { NodeRefs } from "@/types/requests/utils/refs"

export function getConnections(refs: GetMyPagesBreadcrumbsRefsData) {
  const connections: Edges<NodeRefs>[] = []
  refs.all_account_page.items.forEach((ref) => {
    connections.push(ref.breadcrumbs.parentsConnection)
  })

  return connections
}

export const affix = "breadcrumbs"

// TODO: Make these editable in CMS?
export const homeBreadcrumbs = {
  [Lang.da]: {
    href: "/da",
    title: "Hjem",
    uid: "da",
  },
  [Lang.de]: {
    href: "/de",
    title: "Heim",
    uid: "de",
  },
  [Lang.en]: {
    href: "/en",
    title: "Home",
    uid: "en",
  },
  [Lang.fi]: {
    href: "/fi",
    title: "Koti",
    uid: "fi",
  },
  [Lang.no]: {
    href: "/no",
    title: "Hjem",
    uid: "no",
  },
  [Lang.sv]: {
    href: "/sv",
    title: "Hem",
    uid: "sv",
  },
}
