import { z } from "zod"

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

export const validateBreadcrumbsRefsConstenstackSchema = z.object({
  all_account_page: z.object({
    items: z.array(
      z.object({
        breadcrumbs: z.object({
          parentsConnection: z.object({
            edges: z.array(
              z.object({
                node: z.object({
                  system: z.object({
                    content_type_uid: z.string(),
                    uid: z.string(),
                  }),
                }),
              })
            ),
          }),
        }),
        system: z.object({
          content_type_uid: z.string(),
          uid: z.string(),
        }),
      })
    ),
  }),
})

export const validateBreadcrumbsConstenstackSchema = z.object({
  all_account_page: z.object({
    items: z.array(
      z.object({
        breadcrumbs: z.object({
          title: z.string(),
          parentsConnection: z.object({
            edges: z.array(
              z.object({
                node: z.object({
                  breadcrumbs: z.object({
                    title: z.string(),
                  }),
                  system: z.object({
                    locale: z.nativeEnum(Lang),
                    uid: z.string(),
                  }),
                  url: z.string(),
                }),
              })
            ),
          }),
        }),
        system: z.object({
          uid: z.string(),
        }),
      })
    ),
  }),
})

export const getBreadcrumbsSchema = z.array(
  z.object({
    href: z.string().optional(),
    title: z.string(),
    uid: z.string(),
  })
)
