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

import type { System } from "../system"
import type { AllRequestResponse } from "../utils/all"
import type { Edges } from "../utils/edges"

interface MyPagesBreadcrumbs {
  web?: {
    breadcrumbs?: {
      title: string
      parentsConnection: Edges<{
        web: {
          breadcrumbs: {
            title: string
          }
          system: {
            locale: Lang
            uid: string
          }
        }
        url: string
      }>
    }
    system: {
      uid: string
    }
  }
}

interface AllPageResponse extends AllRequestResponse<MyPagesBreadcrumbs> {}

export interface GetMyPagesBreadcrumbsData {
  all_account_page: AllPageResponse
}

export interface GetLoyaltyPageBreadcrumbsData {
  all_loyalty_page: AllPageResponse
}

export interface GetBreadcrumbsItems {
  items: MyPagesBreadcrumbRefs[]
}

interface MyPagesBreadcrumbRefs extends System {
  web?: {
    breadcrumbs?: {
      parentsConnection: Edges<System>
      title: string
    }
  }
}

interface AllPageRefsResponse
  extends AllRequestResponse<MyPagesBreadcrumbRefs> {}

export interface GetMyPagesBreadcrumbsRefsData {
  all_account_page: AllPageRefsResponse
}

export interface GetLoyaltyPageBreadcrumbsRefsData {
  all_loyalty_page: AllPageRefsResponse
}
